runDialog: catch the case where no completion is available

Just return null, instead of failing with an exception later trying to
call substr() on null.

https://bugzilla.gnome.org/show_bug.cgi?id=735062
This commit is contained in:
Cosimo Cecchi 2014-08-13 15:13:20 -07:00 committed by Cosimo Cecchi
parent d0fe1211f2
commit d54efe0838

View File

@ -182,6 +182,10 @@ const RunDialog = new Lang.Class({
let results = someResults.reduce(function(a, b) {
return a.concat(b);
}, []);
if (!results.length)
return null;
let common = results.reduce(_getCommon, null);
return common.substr(text.length);
},