From ee6d8e6ce3336979cb82fbb48634f42bbedb54d6 Mon Sep 17 00:00:00 2001 From: Prateek Papriwal Date: Fri, 6 Nov 2015 19:18:37 +0900 Subject: [PATCH] add null check The reason for adding this null check is that sometimes, for eg. in case of building yuidoc for https://github.com/photonstorm/phaser, when you try to toggle from 'classes' panel to 'modules' panel, the following error is being thrown -: ```Uncaught TypeError: Cannot read property 'toLowerCase' of null```. For catching this error, I think adding a null check would be a good solution. Although I think, there might be some other reason which is leading to the error in the above case. Please check this. For your reference, version of my yuidoc is 0.9.0 . --- themes/default/assets/js/api-filter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/themes/default/assets/js/api-filter.js b/themes/default/assets/js/api-filter.js index d442e543..d8aeaf6e 100644 --- a/themes/default/assets/js/api-filter.js +++ b/themes/default/assets/js/api-filter.js @@ -40,8 +40,10 @@ Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], { var data = Y.YUIDoc.meta[self.get('queryType')], out = []; Y.each(data, function(v) { - if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) { - out.push(v); + if (v != null) { + if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) { + out.push(v); + } } }); return out;