[gnome-shell] lookingGlass: Throw a clearer error on referencing invalid result index
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] lookingGlass: Throw a clearer error on referencing invalid result index
- Date: Mon, 9 Sep 2019 19:37:23 +0000 (UTC)
commit ba23fd9989778b32cf7b3377d1d82150e49b9ebd
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Mon May 20 23:27:48 2019 +0200
lookingGlass: Throw a clearer error on referencing invalid result index
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700
js/ui/lookingGlass.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index a53fd90db7..2c1239cd5f 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -1010,7 +1010,11 @@ var LookingGlass = class LookingGlass {
}
getResult(idx) {
- return this._results[idx - this._offset].o;
+ try {
+ return this._results[idx - this._offset].o;
+ } catch (e) {
+ throw new Error(`Unknown result at index ${idx}`);
+ }
}
toggle() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]