title: How to properly do null checks using Kotlin extension functions on an Android Activity
body: <p>I'm new to Kotlin and trying to convert one of the many Android Util methods we have in our existing codebase into a Kotlin extension function.</p>
  
  <p>This is the Kotlin code:</p>
  
  <pre><code>fun Activity?.isAlive(): Boolean {
      return !(this?.isFinishing ?: false)
  }
  </code></pre>
  
  <p>Which is meant to be the equivalent of this Java method:</p>
  
  <pre><code>public static boolean isAlive(Activity activity) {
      return activity != null &amp;&amp; !activity.isFinishing();
  }
  </code></pre>
  
  <p>However, I'm still getting <code>NPEs</code> in the Kotlin code whenever an <code>Activity</code> is <code>null</code>. Any thoughts on where I'm going wrong?</p>