title: NullPointerException: add a check when taking a photo?
body: <p>Running the example <a href="https://gist.github.com/jsfan3/7fc101523955e8179fadd2c713a09e05" rel="nofollow noreferrer">https://gist.github.com/jsfan3/7fc101523955e8179fadd2c713a09e05</a> I received two times an odd crash report, regarding a NullPointerException. However the crash report is not very clear: </p>
  
  <pre><code>[EDT] 0:1:23,121 - Exception: java.lang.NullPointerException - Attempt to invoke virtual method 'java.lang.Object com.codename1.q.b.a.e()' on a null object reference
  java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object com.codename1.q.b.a.e()' on a null object reference
      at net.informaticalibera.test.capturephoto.b.b(MyApplication.java:99)
  </code></pre>
  
  <p>The line <code>MyApplication.java:99</code> is:
  <code>galleryBtn.addActionListener(a -&gt; CN.openGallery(l -&gt; {</code></p>
  
  <p>I don't understand what can be null in that line.</p>
  
  <p>For safety, I've just added <code>l != null</code> in the next line:
  <code>if (l != null &amp;&amp; l.getSource() != null) {</code></p>
  
  <p>but I'm not sure if this make sense... and, however, the crash report refers to the previous line.</p>
  
  <p>What do you think about that crash report? Thank you</p>