Просмотр исходного кода

Do not push null pointer user types

Ole лет назад: 10
Родитель
Сommit
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);