瀏覽代碼

Do not push null pointer user types

Ole 10 年之前
父節點
當前提交
8c6ab68287
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      lib/luwra/usertypes.hpp

+ 3 - 0
lib/luwra/usertypes.hpp

@@ -205,6 +205,9 @@ struct Value<T*> {
 
 	static inline
 	int push(State* state, T* instance) {
+		if (instance == nullptr)
+			return 0;
+
 		// push instance as light user data
 		lua_pushlightuserdata(state, instance);