From 2458260dfa085505c7ec5b3ece4b29f59cf3d785 Mon Sep 17 00:00:00 2001 From: Truls Henrik Jakobsen Date: Tue, 7 Jan 2025 10:58:44 +0100 Subject: [PATCH] add null check to Week == operator --- backend/Core/Weeks/Week.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/Core/Weeks/Week.cs b/backend/Core/Weeks/Week.cs index 46ed521d..e0d99c72 100644 --- a/backend/Core/Weeks/Week.cs +++ b/backend/Core/Weeks/Week.cs @@ -171,6 +171,9 @@ private bool DateIsInWeek(DateOnly day) public static bool operator ==(Week left, Week right) { + if (ReferenceEquals(left, right)) return true; + if (ReferenceEquals(left, null)) return false; + if (ReferenceEquals(right, null)) return false; return left.Year == right.Year && left.WeekNumber == right.WeekNumber; }