title: Can't have a conditional image source statement?
body: <p>I don't know why but I get the following error: </p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
  </blockquote>
  
  <p>With this code: </p>
  
  <pre><code>private void volumeTracker_ValueChanged(object sender, RoutedPropertyChangedEventArgs&lt;double&gt; e) 
  {
      video.Volume = volumeTracker.Value;
  
      if (volumeTracker.Value == 0) 
      {
          volume.Source = new BitmapImage(new Uri("pack://application:,,,/Images/mutebutton.png"));
      }
      else
      {
          volume.Source = new BitmapImage(new Uri("pack://application:,,,/Images/volumebutton.png")); //Error occurs on this line
      }
  }
  </code></pre>
  
  <p>This makes no sense to me seeing as it works, if I just set the source once (<em>for example if I removed the else part of this code</em>).</p>