From d8ab090d47025c2d06f81edb0475de5e2c1de9e2 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 15 May 2024 10:47:40 -0400 Subject: [PATCH] gdm/util: Make sure error is GError before checking it The fingerprint device fetching code has a generic error handler, that assumes the passed in error is GError. If it's not a GError it will fail trying to use GError specific methods. This commit adds some validation checking. Part-of: --- js/gdm/util.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/js/gdm/util.js b/js/gdm/util.js index 97df6d687..303be0d62 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -395,15 +395,16 @@ export class ShellUserVerifier extends Signals.EventEmitter { _handleFingerprintError(e) { this._fingerprintReaderType = FingerprintReaderType.NONE; - if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) - return; - if (e.matches(Gio.DBusError, Gio.DBusError.SERVICE_UNKNOWN)) - return; - - if (Gio.DBusError.is_remote_error(e) && - Gio.DBusError.get_remote_error(e) === - 'net.reactivated.Fprint.Error.NoSuchDevice') - return; + if (e instanceof GLib.Error) { + if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) + return; + if (e.matches(Gio.DBusError, Gio.DBusError.SERVICE_UNKNOWN)) + return; + if (Gio.DBusError.is_remote_error(e) && + Gio.DBusError.get_remote_error(e) === + 'net.reactivated.Fprint.Error.NoSuchDevice') + return; + } logError(e, 'Failed to interact with fprintd service'); }