title: Java: How to check if object is null?
body: <p>I am creating an application which retrieves images from the web. In case the image cannot be retrieved another local image should be used.</p>
  
  <p>While trying to execute the following lines:</p>
  
  <pre><code>Drawable drawable = Common.getDrawableFromUrl(this, product.getMapPath());
  if (drawable.equals(null)) {
    drawable = getRandomDrawable();
  }
  </code></pre>
  
  <p>The line if(drawable.equals(null)) throws an exception if drawable is null.</p>
  
  <p>Does anyone know how should the value of drawable be checked in order not to throw an exception in case it is null and retrieve the local image (execute drawable = getRandomDrawable())?</p>