Skip to content

Commit acd8948

Browse files
BogdanZavuzavub
andauthored
DYN-9845 : handle invalid input (#16728)
Co-authored-by: Bogdan Zavu <[email protected]>
1 parent fc1ae8a commit acd8948

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Libraries/CoreNodeModels/DropDown.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ public static int ParseSelectedIndexImpl(string index, IList<DynamoDropDownItem>
230230
}
231231
else
232232
{
233-
var tempIndex = Convert.ToInt32(index);
233+
if (!int.TryParse(index, out int tempIndex))
234+
{
235+
return selectedIndex;
236+
}
237+
234238
selectedIndex = tempIndex > (items.Count - 1) ?
235239
-1 :
236240
tempIndex;

0 commit comments

Comments
 (0)