The Free Software Media System - Server Backend & API
fixed overflow exception in alphanum comparer
Luke Pulverentice51973a8087
diff --git a/MediaBrowser.Server.Implementations/Sorting/AlphanumComparator.cs b/MediaBrowser.Server.Implementations/Sorting/AlphanumComparator.csindex 3fbb01f779..39a68b3f6b 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 numericallyif (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){