From 45440659c65e451c8b9c41cacb8b09e89f621456 Mon Sep 17 00:00:00 2001 From: Amir Arad Date: Thu, 12 Oct 2017 18:34:00 +0300 Subject: [PATCH] fix bug `Uncaught TypeError: Cannot read property 'length' of undefined` when component receives data but has no `target` property --- src/browser/js/app/osc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/js/app/osc.js b/src/browser/js/app/osc.js index 9cb9dc66..cbbd37e3 100644 --- a/src/browser/js/app/osc.js +++ b/src/browser/js/app/osc.js @@ -70,7 +70,7 @@ Osc.prototype.receive = function(data){ // if the message target is provided (when message comes from another client connected to the same server) // then we only update the widgets that have the same target // compare arrays using > and < operators (both false = equality) - if (!target || !(widget[i].getProp('target') < target || widget[i].getProp('target') > target || widget[i].getProp('target').length != target.length)) { + if (!target || !(widget[i].getProp('target') < target || widget[i].getProp('target') > target || (widget[i].getProp('target') && widget[i].getProp('target').length !== target.length))) { // update matching widgets if (widget[i] && widget[i].setValue) widget[i].setValue(args,{send:false,sync:true,fromExternal:!target}) }