extensionSystem: Check if extension exists before accessing property

If the extension doesn't exist in the `this._extensions` Map, we'd try
to access `extension.dir` on undefined/null. So set the `dir` variable
after checking if `extension` is defined.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
This commit is contained in:
Jonas Dreßler 2019-09-11 14:36:18 +02:00 committed by Florian Müllner
parent 2a32fb2e72
commit e76877c4b8

View File

@ -303,11 +303,10 @@ var ExtensionManager = class {
_callExtensionInit(uuid) {
let extension = this.lookup(uuid);
let dir = extension.dir;
if (!extension)
throw new Error("Extension was not properly created. Call createExtensionObject first");
let dir = extension.dir;
let extensionJs = dir.get_child('extension.js');
if (!extensionJs.query_exists(null)) {
this.logExtensionError(uuid, new Error('Missing extension.js'));