From 91fd65378e2c9a381dd64e467d6ba05d0a914169 Mon Sep 17 00:00:00 2001 From: urhend Date: Sat, 1 Aug 2026 21:38:04 +0200 Subject: [PATCH] Remove two more unnecessary-check patterns; bump to v1.0.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Drop `e instanceof GLib.Error` guard in runCommand()'s first catch — proc.init() only ever throws GLib.Error given our fully-controlled argv, so the check never does anything. The sibling catch block a few lines down (around communicate_utf8_async) never had this guard, which made the asymmetry obvious in hindsight. - Drop optional chaining on this._networkNameLabel in _maybeNotifyStateChange — _buildMenu() always runs before _refresh() can reach this code path, so the label is guaranteed to exist. Same category as the this._destroyed flag removed in dca6371: a defensive check written for a case that can't actually happen at its call site. --- extension.js | 8 ++------ metadata.json | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/extension.js b/extension.js index e87fa92..c3da089 100644 --- a/extension.js +++ b/extension.js @@ -74,11 +74,7 @@ async function runCommand(argv, cancellable) { }); proc.init(cancellable); } catch (e) { - if ( - e instanceof GLib.Error && - e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED) - ) - throw e; + if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) throw e; return { success: false, stdout: "", stderr: e.message ?? String(e) }; } @@ -598,7 +594,7 @@ const Indicator = GObject.registerClass( category !== this._previousCategory && this._settings.get_boolean("notifications-enabled") ) { - const network = this._networkNameLabel?.text || "Twingate"; + const network = this._networkNameLabel.text || "Twingate"; if (category === "connected") Main.notify("Twingate", `Connected to ${network}`); else if (category === "disconnected") diff --git a/metadata.json b/metadata.json index 9694fcb..8a8c725 100644 --- a/metadata.json +++ b/metadata.json @@ -6,5 +6,5 @@ "settings-schema": "org.gnome.shell.extensions.twingate-panel", "shell-version": ["50"], "version": 1, - "version-name": "1.0.4" + "version-name": "1.0.6" }