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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3319>
This commit is contained in:
Ray Strode 2024-05-15 10:47:40 -04:00 committed by Marge Bot
parent 3220005eea
commit d8ab090d47

View File

@ -395,15 +395,16 @@ export class ShellUserVerifier extends Signals.EventEmitter {
_handleFingerprintError(e) {
this._fingerprintReaderType = FingerprintReaderType.NONE;
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');
}