lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In function : void LoadConstants(LoadState* S, Proto* f)

If the constant is string, it will be call setsvalue2n .

case LUA_TSTRING:
  setsvalue2n(S->L,o,LoadString(S));

and setsvalue2n  crashes if LoadString(S) return NULL.

I think if we check the return value of LoadString here would be better :

case LUA_TSTRING: {
    TString * s = LoadString(S);
    if (s) {
      setsvalue2n(S->L,o,s);
    } else {
       setnilvalue(o);
    }
    break;
}

-- 
http://blog.codingnow.com