title: android: service with null intent
body: <p>I have a widget that updates through a service whose onStart() references an Intent.  After a period of using other applications, it seems as if the Android system restarts the service, presumably in some resource management capacity, leaving this intent null.  In my onStart(), I am checking for null intent:</p>
  
  <pre><code>public void onStart(Intent intent, int startId){
  
      if(intent != null){
         //do stuff
  
       } else {
          System.out.println("service restarted");
      }
  </code></pre>
  
  <p>}</p>
  
  <p>But I am getting a nullPointerException on the conditional statement.  </p>
  
  <p>What is the correct way of dealing with this?  The service is run from an alarm once per hour, so all it needs to do is run updateAppWidget when the system restarts it (I think...), but I'm not sure how to avoid this null pointer.</p>