title: What to do when logcat shows error in non-existent lines in android studio
body: <p>I have edited the <code>NullPointerException</code> present in <code>MainActivity</code> and have exported (cut, copy and paste)them into another class. But my Logcat shows an error in <code>MainActivity</code>.
  After modifying for `NullPointerException this is my code:</p>
  <pre class="lang-java prettyprint-override"><code>    if(value!=null &amp;&amp; value.length()&gt;0){
        try{
          length = Integer.parseInt(value);
  
        }
        catch (NullPointerException e){
          length=0;
        }
      }
  </code></pre>
  <p>My logcat shows:</p>
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable 
          android.widget.EditText.getText()' on a null object reference
          at com.example.caddrawingtool.MainActivity.drawline(MainActivity.java:114)
          at com.example.caddrawingtool.MainActivity.onOptionsItemSelected(MainActivity.java:57)
          at android.app.Activity.onMenuItemSelected(Activity.java:4137)
          at androidx.fragment.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:384)
          at androidx.appcompat.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:228)
        androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:109)
  </code></pre>
  <p>when my <code>MainActivity</code> has only 109 lines. I am confused.</p>