Skip to content

Commit 80428dd

Browse files
authored
Merge pull request #1123 from Unity-Technologies/avoid-timezone-exceptions
Don't use exceptions for time zones (case 1100856)
2 parents a1597e0 + 0219c20 commit 80428dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mcs/class/corlib/System/TimeZoneInfo.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ static TimeZoneInfo CreateLocal ()
209209
string tzName = null;
210210
if (!TryGetNameFromPath (tzFilePath, out tzName))
211211
tzName = "Local";
212-
return FindSystemTimeZoneByFileName (tzName, tzFilePath);
212+
if (File.Exists(tzFilePath))
213+
return FindSystemTimeZoneByFileName (tzName, tzFilePath);
213214
} catch (TimeZoneNotFoundException) {
214215
continue;
215216
}
@@ -1561,4 +1562,4 @@ public override string ToString ()
15611562
}
15621563
#endif
15631564
}
1564-
}
1565+
}

0 commit comments

Comments
 (0)