소스 검색

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);