Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Commit

Permalink
Added Null Checking for the TheaterScheduleComparer
Browse files Browse the repository at this point in the history
  • Loading branch information
bofirial committed Jun 11, 2017
1 parent caa164f commit 450eae2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Melody49Notifier/Models/TheaterScheduleComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ public bool AreEqual(TheaterSchedule firstTheaterSchedule, TheaterSchedule secon
{
bool areEqual = true;

areEqual = areEqual && firstTheaterSchedule.ScheduleDescription == secondTheaterSchedule.ScheduleDescription;
areEqual = areEqual && firstTheaterSchedule.TheaterName == secondTheaterSchedule.TheaterName;
areEqual = areEqual && firstTheaterSchedule.Showings.Count == secondTheaterSchedule.Showings.Count;
areEqual = areEqual && firstTheaterSchedule?.ScheduleDescription == secondTheaterSchedule?.ScheduleDescription;
areEqual = areEqual && firstTheaterSchedule?.TheaterName == secondTheaterSchedule?.TheaterName;
areEqual = areEqual && firstTheaterSchedule?.Showings?.Count == secondTheaterSchedule?.Showings?.Count;

for (int i = 0; i < firstTheaterSchedule.Showings.Count; i++)
for (int i = 0; i < firstTheaterSchedule?.Showings?.Count; i++)
{
areEqual = areEqual && firstTheaterSchedule.Showings[i].MovieDescription == secondTheaterSchedule.Showings[i].MovieDescription;
//areEqual = areEqual && firstTheaterSchedule.Showings[i].Screen == secondTheaterSchedule.Showings[i].Screen;
//areEqual = areEqual && firstTheaterSchedule.Showings[i].ShowingScheduleDescription == secondTheaterSchedule.Showings[i].ShowingScheduleDescription;
//areEqual = areEqual && firstTheaterSchedule.Showings[i].ActorDescription == secondTheaterSchedule.Showings[i].ActorDescription;
areEqual = areEqual && firstTheaterSchedule?.Showings?[i]?.MovieDescription == secondTheaterSchedule?.Showings?[i]?.MovieDescription;
//areEqual = areEqual && firstTheaterSchedule?.Showings?[i]?.Screen == secondTheaterSchedule?.Showings?[i]?.Screen;
//areEqual = areEqual && firstTheaterSchedule?.Showings?[i]?.ShowingScheduleDescription == secondTheaterSchedule?.Showings?[i]?.ShowingScheduleDescription;
//areEqual = areEqual && firstTheaterSchedule?.Showings?[i]?.ActorDescription == secondTheaterSchedule?.Showings?[i]?.ActorDescription;
}

return areEqual;
Expand Down

0 comments on commit 450eae2

Please sign in to comment.