title: Checking if JSONObject is null, and in doing so crashes my application
body: <p>I'm trying to see if the <code>JSONObject</code> 'FirstItemMGNAME2' is null, however when it is null it just crashes the program, and when it is not null, it just displays the else statement. </p>
  
  <p>In short, im just trying to see if a string exsits in a JSONObject, and create an if statement</p>
  
  <pre><code>JSONObject FirstItemMGNAME2 = FirstItemArrayMG.getJSONObject(FirstItemArrayMG.length() - 2);
  if (FirstItemMGNAME2.isNull("name")){
      FirstItemIDMGNAME2 = "1";
  }
  else {
      FirstItemIDMGNAME2 = FirstItemMGNAME2.getString("name");
  }
  </code></pre>
  
  <p>Here is the logcat when the app crashes</p>
  
  <pre><code>08-21 16:14:40.237 20945-20945/com.kripzy.lolbuilds E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.kripzy.lolbuilds, PID: 20945
  java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
    at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:337)
    at android.widget.ListView.setAdapter(ListView.java:491)
    at com.kripzy.lolbuilds.Aatrox$JSONTask.onPostExecute(Aatrox.java:447)
    at com.kripzy.lolbuilds.Aatrox$JSONTask.onPostExecute(Aatrox.java:67)
    at android.os.AsyncTask.finish(AsyncTask.java:651)
    at android.os.AsyncTask.-wrap1(AsyncTask.java)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>
  
  <p>As people asked for all of my code here it - <a href="http://pastebin.com/JYsinqRw" rel="nofollow">http://pastebin.com/JYsinqRw</a> (had to be on pastebin due to the body being limtited to 30,000 characters)</p>