Added Sanity check to prevent null reference exception  that was crashing the preview and causing the preview to be non-responsive