title: Converting javascript object which contains nothing to a string
body: <p>I am writing an extension for the gnome-shell. The javascript extension spawns a sql query and captures the output on standard output. In cases where the sql query evaluates to 0 tuples/records my extension is crashing.</p>
  
  <p>Below is the code snippet.</p>
  
  <pre><code>let [success, out, err, error] = GLib.spawn_sync(null, ["sqlite3", "-line", places, sqlQuery], null, 4, null);
  let result = out.toString(); // Crashing here for 0 tuples. I was expecting 'result = ""'
  </code></pre>
  
  <p>I am a javascript newbie. I am not understanding how the object <code>out</code> should be handled in this scenario. The object is not null; nor is it undefined.</p>
  
  <pre><code>typeof out == null // false
  typeof out == undefined // false
  typeof out == "object" // true
  </code></pre>
  
  <p>EDIT</p>
  
  <pre><code>typeof out == "null" // false
  typeof out == "undefined" // false
  typeof out == "object" // true
  </code></pre>