Skip to content

Commit ce4dd4f

Browse files
committed
handle invalid input
1 parent da9c37c commit ce4dd4f

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)