فهرست منبع

2010-07-09 Gonzalo Paniagua Javier <[email protected]>

	* TimeZoneInfo.cs: avoid nullref when there are no adjustment rules.
	Fixes bug #619811.


svn path=/trunk/mcs/; revision=160159
Gonzalo Paniagua Javier 15 سال پیش
والد
کامیت
4e6e02a348
2فایلهای تغییر یافته به همراه13 افزوده شده و 6 حذف شده
  1. 5 0
      mcs/class/System.Core/System/ChangeLog
  2. 8 6
      mcs/class/System.Core/System/TimeZoneInfo.cs

+ 5 - 0
mcs/class/System.Core/System/ChangeLog

@@ -1,3 +1,8 @@
+2010-07-09 Gonzalo Paniagua Javier <[email protected]>
+
+	* TimeZoneInfo.cs: avoid nullref when there are no adjustment rules.
+	Fixes bug #619811.
+
 2010-06-09 Rodrigo Kumpera  <[email protected]>
 
 	* Actions.cs: Add missing v4 type forwarding.

+ 8 - 6
mcs/class/System.Core/System/TimeZoneInfo.cs

@@ -746,12 +746,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;
 		}