Skip to content

Commit

Permalink
fixed wrong osc send data type check
Browse files Browse the repository at this point in the history
  • Loading branch information
marmorkuchen.net committed Aug 10, 2014
1 parent 47b6d09 commit 8748778
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "osc-js",
"description": "OSC protocol interface with address pattern matching for javascript applications",
"version": "0.1.0",
"version": "0.1.1",
"authors": [
"marmorkuchen.net <[email protected]>"
],
Expand Down
14 changes: 9 additions & 5 deletions dist/osc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! osc-js - v0.1.0 - 2014-05-14 by marmorkuchen.net */
/*! osc-js - v0.1.1 - 2014-08-10 by marmorkuchen.net */
(function(window, undefined) {
"use strict";
var FLAGS = {
Expand Down Expand Up @@ -214,11 +214,15 @@
}
};
OSCSocket.prototype.send = function(sData) {
if (sData && sData instanceof ArrayBuffer) {
this._socket.send(sData.buffer);
return true;
if (this._socket) {
if (sData && sData.buffer && sData.buffer instanceof ArrayBuffer) {
this._socket.send(sData.buffer);
return true;
} else {
return false;
}
} else {
return false;
throw "OSCSocket Error: WebSocket is not ready to send OSC data";
}
};
var OSCAtomic = {};
Expand Down
4 changes: 2 additions & 2 deletions dist/osc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/osc.min.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "osc-js",
"version": "0.1.0",
"version": "0.1.1",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.4",
Expand Down
12 changes: 8 additions & 4 deletions src/osc.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,15 @@
};

OSCSocket.prototype.send = function(sData) {
if (sData && sData instanceof ArrayBuffer) {
this._socket.send(sData.buffer);
return true;
if (this._socket) {
if (sData && sData.buffer && sData.buffer instanceof ArrayBuffer) {
this._socket.send(sData.buffer);
return true;
} else {
return false;
}
} else {
return false;
throw 'OSCSocket Error: WebSocket is not ready to send OSC data';
}
};

Expand Down

0 comments on commit 8748778

Please sign in to comment.