[gnome-shell] lookingGlass: Also handle null objects in objectToString



commit 26a49168ba2abcd60e66f64c3a3dcf8deda0c1e8
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Wed Feb 19 11:53:05 2020 +0100

    lookingGlass: Also handle null objects in objectToString
    
    Whoops, while ff4623454 fixed the handling of `undefined` objects,
    `null` objects obviously still don't have a toString() method. So also
    handle those and return 'null' in case the object is null.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1024

 js/ui/lookingGlass.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 54e3e48581..ed0186cc2f 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -244,7 +244,13 @@ function objectToString(o) {
         // special case this since the default is way, way too verbose
         return '<js function>';
     } else {
-        return o !== undefined ? o.toString() : 'undefined';
+        if (o === undefined)
+            return 'undefined';
+
+        if (o === null)
+            return 'null';
+
+        return o.toString();
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]