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:
parent
2a32fb2e72
commit
e76877c4b8
@ -303,11 +303,10 @@ var ExtensionManager = class {
|
|||||||
|
|
||||||
_callExtensionInit(uuid) {
|
_callExtensionInit(uuid) {
|
||||||
let extension = this.lookup(uuid);
|
let extension = this.lookup(uuid);
|
||||||
let dir = extension.dir;
|
|
||||||
|
|
||||||
if (!extension)
|
if (!extension)
|
||||||
throw new Error("Extension was not properly created. Call createExtensionObject first");
|
throw new Error("Extension was not properly created. Call createExtensionObject first");
|
||||||
|
|
||||||
|
let dir = extension.dir;
|
||||||
let extensionJs = dir.get_child('extension.js');
|
let extensionJs = dir.get_child('extension.js');
|
||||||
if (!extensionJs.query_exists(null)) {
|
if (!extensionJs.query_exists(null)) {
|
||||||
this.logExtensionError(uuid, new Error('Missing extension.js'));
|
this.logExtensionError(uuid, new Error('Missing extension.js'));
|
||||||
|
Loading…
Reference in New Issue
Block a user