lua: json: catch syntax errors when converting to native lua types
and most importantly, push nil on the stack, so that there is something returned from this function... the caller always expects a value to be pushed
This commit is contained in:
@@ -165,6 +165,13 @@ push_luajson (lua_State *L, WpSpaJson *json)
|
||||
lua_setfield (L, -2, key_str);
|
||||
}
|
||||
}
|
||||
|
||||
/* syntax error */
|
||||
else {
|
||||
g_autofree gchar *value = wp_spa_json_parse_string (json);
|
||||
wp_warning ("unknown SPA JSON token type at '%s'", value);
|
||||
lua_pushnil (L);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
Reference in New Issue
Block a user