title: Retrofit Android: Method invocation 'getSuccess' may produce 'java.lang.NullPointerException'
body: <p>I am using Retroft and GSON for parsing the response.</p>
  
  <p>My <code>onResponse</code> code is like below</p>
  
  <pre><code>@Override
  public void onResponse(@NonNull Call&lt;ResultList&gt; call, @NonNull Response&lt;ResultList&gt; response) {
      if (response.isSuccessful()) {
          if (response.body() != null &amp;&amp; response.body().getSuccess() == 1) {
              ................
  </code></pre>
  
  <p>I am checking <code>response.body() != null</code> and also <code>response.isSuccessful()</code>.
  Still I am getting warning in Android studio on line  <code>response.body().getSuccess()</code>. </p>
  
  <p>How to avoid this warning?</p>
  
  <p>I am using retrofit:2.3.0 and gson:2.8.1.
  I already tried the solution on this question  (<a href="https://stackoverflow.com/questions/45422911/retrofit-method-invocation-may-produce-java-lang-nullpointerexception">Retrofit Method invocation may produce &#39;java.lang.NullPointerException&#39;</a>
  ). But it was not working</p>