-rw-r--r-- | agg-plot/window.cpp | 5 |
diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp index 3114f430..a2a5aa27 100644 --- a/agg-plot/window.cpp +++ b/agg-plot/window.cpp @@ -418,9 +418,10 @@ show_window(lua_State* L, window* win) int window_new (lua_State *L) { - window *win = push_new_object<window>(L, GS_WINDOW, global_state); const char *spec = lua_tostring (L, 1); - int defer_show = lua_toboolean(L, 2); + int defer_show = (lua_gettop(L) >= 2 ? lua_toboolean(L, 2) : 0); + + window *win = push_new_object<window>(L, GS_WINDOW, global_state); if (spec) { |