Skip to content

Commit c1ab9e3

Browse files
committed
Change Linq query to pull an item out that isn't used to instead check if the index is out of range of the array
1 parent b9ea86d commit c1ab9e3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/LZString.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ public static string decompress(string compressed)
302302
numBits++;
303303
}
304304

305-
306-
if (dictionary.ElementAtOrDefault((int)c) != null) // if (dictionary[c] ) <------- original Javascript Equivalant
305+
if (dictionary.Count - 1 >= c) // if (dictionary[c] ) <------- original Javascript Equivalant
307306
{
308307
entry = dictionary[c];
309308
}

0 commit comments

Comments
 (0)