I have this code:
public void OnDisappearing()
{
runPointsChecker = false;
timerSeconds = 0;
cts.Cancel();
//cts.Token.ThrowIfCancellationRequested();
if (Settings.Mode == Enums.MO.Quiz && App.showCard.Running())
StopQuiz();
//Code to Stop the stop watch and insert the values in the database.
ScreenTimeStopWatch.StopScreenTimeStopwatchAndToDatabase();
ScreenTimeStopWatch.KillScreenTimeStopwatch();
}
The code block is failing with a null object exception. Can someone give me some suggestions on how I could add to this to protect this from happening?