Преглед изворни кода

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