Index: generic/nsf.c =================================================================== diff -u -ra35803ea84148ebadd79d8527830dcbdebd8873e -r8c16e18f186d305671e9543bf3c5d23fa65dc684 --- generic/nsf.c (.../nsf.c) (revision a35803ea84148ebadd79d8527830dcbdebd8873e) +++ generic/nsf.c (.../nsf.c) (revision 8c16e18f186d305671e9543bf3c5d23fa65dc684) @@ -16904,15 +16904,19 @@ } } - if (tcd->prefix) { - /* - * If a prefix was provided, prepend a prefix for the subcommands to - * avoid name clashes. - */ - Tcl_Obj *methodName = Tcl_DuplicateObj(tcd->prefix); - Tcl_AppendObjToObj(methodName, ov[1]); - ov[1] = methodName; - INCR_REF_COUNT(ov[1]); + /* + If a prefix is provided, it will be prepended to the 2nd argument. This + allows for avoiding name clashes if the 2nd argument denotes a + subcommand, for example. + + Make sure that the prefix is only prepended, if a second arg is + actually available! Otherwise, the requested prefix has no effect. + */ + if (tcd->prefix && objc > 1) { + Tcl_Obj *methodName = Tcl_DuplicateObj(tcd->prefix); + Tcl_AppendObjToObj(methodName, ov[1]); + ov[1] = methodName; + INCR_REF_COUNT(ov[1]); } #if 0 @@ -16926,7 +16930,9 @@ result = CallForwarder(tcd, interp, objc, ov); - if (tcd->prefix) {DECR_REF_COUNT(ov[1]);} + if (tcd->prefix && objc > 1) { + DECR_REF_COUNT(ov[1]); + } exitforwardmethod: if (freeList) {DECR_REF_COUNT2("freeList", freeList);}