1
0
Fork 0

Fix mean nasal bug when calling setprop("foo")

Reported on the forum from Thorsten Renk and analyzed by
Hooray, fixes this issue:
var x="/test/X";
var y="/test/Y";

setprop(x,100); # sets x=100
setprop(y); # sets x=0

setprop(x,100);
setprop(200); # sets x=200

by checking for at least 2 parameters for setprop
This commit is contained in:
Torsten Dreyer 2010-09-13 22:15:50 +02:00
parent 31a807563b
commit a5017f218f

View file

@ -212,6 +212,7 @@ static naRef f_setprop(naContext c, naRef me, int argc, naRef* args)
buf[BUFLEN] = 0;
char* p = buf;
int buflen = BUFLEN;
if(argc < 2) naRuntimeError(c, "setprop() expects at least 2 arguments");
for(int i=0; i<argc-1; i++) {
naRef s = naStringValue(c, args[i]);
if(naIsNil(s)) return naNil();