Sfoglia il codice sorgente

Do not push null pointer user types

Ole 10 anni fa
parent
commit
8c6ab68287
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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);