title: My application crashes when getting uri from user
body: <p>I have a problem. I want to get the user of my app to select an audio file from storage using ACTION_GET_CONTENT, and my mainActivity crashes at that point. </p>
  
  <pre><code>       public void onClick(View v) {
              Intent intent = new Intent();
              intent.setType("audio/*");
              intent.setAction(Intent.ACTION_GET_CONTENT);
              startActivityForResult(intent,1);
              audioPath = intent.getData().getPath(); //This is were the crash happens
              audio = Uri.parse(audioPath);
  
          }
  </code></pre>
  
  <p>I'm new in android programming and there is surely something that I fail to understand. The error is as follows: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getPath()' on a null object reference</p>