From 43b47227ebdcb4e4868207db43c3a82bed48ad5c Mon Sep 17 00:00:00 2001 From: Rene Floor Date: Mon, 4 Nov 2019 10:33:28 +0100 Subject: [PATCH] Checking for int.MinValue separately. For some reason GetField("MinValue") can fail on integers. --- .../DataTypes/RecurrencePatternSerializer.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net-core/Ical.Net/Serialization/DataTypes/RecurrencePatternSerializer.cs b/net-core/Ical.Net/Serialization/DataTypes/RecurrencePatternSerializer.cs index 5bb506f38..18e4a3968 100644 --- a/net-core/Ical.Net/Serialization/DataTypes/RecurrencePatternSerializer.cs +++ b/net-core/Ical.Net/Serialization/DataTypes/RecurrencePatternSerializer.cs @@ -75,6 +75,14 @@ public virtual void CheckMutuallyExclusive(string name1, string name2, T { return; } + + // For some reason GetField("MinValue") sometimes returns 'null' when the obj is an int + // Casting the object to an int and directly checking for MinValue works though. + if (obj1 is int c && c == int.MinValue) + { + return; + } + // If the object is MinValue instead of its default, consider // that to be unassigned.