aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-26 09:20:04 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-26 09:20:04 -0500
commitce51973a8087b0fc48e887f2155eb05b1de2e0ac (patch)
tree87df702dfce28ec9105a7cebd95aefb4eadd77ee
parent25db52003c20473e94e07fb02adf43549a4ba213 (diff)
fixed overflow exception in alphanum comparer
-rw-r--r--MediaBrowser.Server.Implementations/Sorting/AlphanumComparator.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/Sorting/AlphanumComparator.cs b/MediaBrowser.Server.Implementations/Sorting/AlphanumComparator.cs
index 3fbb01f77..39a68b3f6 100644
--- a/MediaBrowser.Server.Implementations/Sorting/AlphanumComparator.cs
+++ b/MediaBrowser.Server.Implementations/Sorting/AlphanumComparator.cs
@@ -78,8 +78,14 @@ namespace MediaBrowser.Server.Implementations.Sorting
// If both chunks contain numeric characters, sort them numerically
if (char.IsDigit(thisChunk[0]) && char.IsDigit(thatChunk[0]))
{
- thisNumericChunk = Convert.ToInt32(thisChunk.ToString());
- thatNumericChunk = Convert.ToInt32(thatChunk.ToString());
+ if (!int.TryParse(thisChunk.ToString(), out thisNumericChunk))
+ {
+ return 0;
+ }
+ if (!int.TryParse(thatChunk.ToString(), out thatNumericChunk))
+ {
+ return 0;
+ }
if (thisNumericChunk < thatNumericChunk)
{