[gnome-shell] extensionSystem: Check if extension exists before accessing property
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] extensionSystem: Check if extension exists before accessing property
- Date: Thu, 12 Sep 2019 10:33:29 +0000 (UTC)
commit e76877c4b889590251fb9b646e7283480979e089
Author: Jonas Dreßler <verdre v0yd nl>
Date: Wed Sep 11 14:36:18 2019 +0200
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
js/ui/extensionSystem.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 47750bda38..98ef13be97 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -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'));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]