title: Check if object is null before calling method. Object reference not set to an instance of an object
body: <p>I keep getting a NullReferenceException.  How do I initialize my doubles to determine if they are null?  Sorry for the noob question :(</p>
  
  <pre><code>private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs&lt;double&gt; e)
  {
  
      //gets new value of slider
      double newValue = (double)Math.Round(e.NewValue);
  
      //gets current/previous value of slider
      double  currentValue = slider1.Value;
  
      //gets sum of previous value - new value 
      double valueSum = (double)Math.Round(currentValue - newValue);
  </code></pre>