diff options
| -rw-r--r-- | lstrlib.c | 2 |
1 files changed, 2 insertions, 0 deletions
| @@ -1271,6 +1271,8 @@ static int str_format (lua_State *L) { | |||
| 1271 | } | 1271 | } |
| 1272 | case 'p': { | 1272 | case 'p': { |
| 1273 | const void *p = lua_topointer(L, arg); | 1273 | const void *p = lua_topointer(L, arg); |
| 1274 | if (p == NULL) | ||
| 1275 | p = "(null)"; /* NULL not a valid parameter in ISO C 'printf' */ | ||
| 1274 | nb = l_sprintf(buff, maxitem, form, p); | 1276 | nb = l_sprintf(buff, maxitem, form, p); |
| 1275 | break; | 1277 | break; |
| 1276 | } | 1278 | } |
