diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2010-07-10 01:37:39 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2010-07-10 01:37:39 +0400 |
commit | 4fd1ce43725c39829ba963e947d43e7d39d4f8cf (patch) | |
tree | dd2c6afc39882bf7bba60a7eabb50b325920a882 /mcs/class | |
parent | 7365be1f630e5583efd27aaab86762a739f4a0d4 (diff) |
2010-07-09 Gonzalo Paniagua Javier <gonzalo@novell.com>
* TimeZoneInfo.cs: avoid nullref when there are no adjustment rules.
Fixes bug #619811.
svn path=/branches/mono-2-6/mcs/; revision=160158
Diffstat (limited to 'mcs/class')
-rw-r--r-- | mcs/class/System.Core/System/TimeZoneInfo.cs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mcs/class/System.Core/System/TimeZoneInfo.cs b/mcs/class/System.Core/System/TimeZoneInfo.cs index 0f5889ed958..6190a0a2356 100644 --- a/mcs/class/System.Core/System/TimeZoneInfo.cs +++ b/mcs/class/System.Core/System/TimeZoneInfo.cs @@ -729,12 +729,14 @@ namespace System if (dateTime.Kind == DateTimeKind.Utc && this != TimeZoneInfo.Utc) date = date + BaseUtcOffset; - foreach (AdjustmentRule rule in adjustmentRules) { - if (rule.DateStart > date.Date) - return null; - if (rule.DateEnd < date.Date) - continue; - return rule; + if (adjustmentRules != null) { + foreach (AdjustmentRule rule in adjustmentRules) { + if (rule.DateStart > date.Date) + return null; + if (rule.DateEnd < date.Date) + continue; + return rule; + } } return null; } |