team.widget returns undefined is there are no widgets of the specified type.
authorMike Taylor <mike@indexdata.com>
Thu, 1 May 2014 14:59:06 +0000 (15:59 +0100)
committerMike Taylor <mike@indexdata.com>
Thu, 1 May 2014 14:59:06 +0000 (15:59 +0100)
src/mkws-team.js

index ef216fc..4d65628 100644 (file)
@@ -452,6 +452,9 @@ function team($, teamName) {
 
     that.widget = function(type) {
         var list = m_widgets[type];
+
+        if (!list)
+            return undefined;
         if (list.length > 1) {
             alert("widget('" + type + "') finds " + list.length + " widgets: using first");
         }