Skip to content

Commit

Permalink
BUG FIX if the objItem.Name is not a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
amalcao committed Jan 12, 2017
1 parent 943fe98 commit 79fac82
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions listComPorts.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ Function GetComPorts()
set objRgx = CreateObject("vbScript.RegExp")
strDevName = objItem.Name
objRgx.Pattern = "COM[0-9]+"
set objRegMatches = objRgx.Execute(strDevName)
if objRegMatches.Count = 1 then
portList.Add objRegMatches.Item(0).Value, objItem
if vbString = VarType(strDevName) then
set objRegMatches = objRgx.Execute(strDevName)
if objRegMatches.Count = 1 then
portList.Add objRegMatches.Item(0).Value, objItem
end if
end if
Next
set GetComPorts = portList
Expand Down

0 comments on commit 79fac82

Please sign in to comment.