Skip to content

Commit 3c1f33f

Browse files
authored
Merge pull request #36 from ukos-git/nonExistingProcedures
fix non existing procedures
2 parents 9a200df + 33040fb commit 3c1f33f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

procedures/CodeBrowser_gui.ipf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ static StrConstant userDataNiceList = "niceList"
2929
static StrConstant oneTimeInitUserData = "oneTimeInit"
3030

3131
static StrConstant selectAll = "<ALL>"
32+
static StrConstant genericError = "_error_"
3233

3334
Function/S GetPanel()
3435
return panel
@@ -253,7 +254,7 @@ Function/S getCurrentItem([module, procedure, index])
253254

254255
// only one optional argument allowed
255256
if(module + procedure + index != 1)
256-
return "_error_"
257+
return genericError
257258
endif
258259

259260
if(module)
@@ -274,14 +275,18 @@ Function/S getCurrentItem([module, procedure, index])
274275

275276
rawList = GetUserData(panel, procCtrl, userDataRawList)
276277
if(V_Value < 0 || V_Value >= ItemsInList(rawList))
277-
return "_error_"
278+
if(ItemsInList(rawList) > 0)
279+
// fall back to first item
280+
return StringFromList(0, rawList)
281+
endif
282+
return genericError
278283
endif
279284

280285
procName = StringFromList(V_Value, rawList)
281286
return procName
282287
endif
283288

284-
return "_error_"
289+
return genericError
285290
End
286291

287292
/// Get the basic procedure name from a full procedure name

0 commit comments

Comments
 (0)