File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/plugins/core/scripting Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,8 @@ bool PluginEvent::GetBool(std::string key)
137137 if (!this ->gameEvent )
138138 return false ;
139139
140+ if (!this ->gameEvent ->HasKey (key.c_str ())) return false ;
141+
140142 return this ->gameEvent ->GetBool (key.c_str ());
141143}
142144
@@ -145,7 +147,9 @@ int PluginEvent::GetInt(std::string key)
145147 REGISTER_CALLSTACK (this ->plugin_name , string_format (" PluginEvent::GetInt(key=\" %s\" )" , key.c_str ()));
146148
147149 if (!this ->gameEvent )
148- return 0 ;
150+ return -1 ;
151+
152+ if (!this ->gameEvent ->HasKey (key.c_str ())) return -1 ;
149153
150154 return this ->gameEvent ->GetInt (key.c_str ());
151155}
@@ -157,6 +161,8 @@ uint64_t PluginEvent::GetUint64(std::string key)
157161 if (!this ->gameEvent )
158162 return 0 ;
159163
164+ if (!this ->gameEvent ->HasKey (key.c_str ())) return 0 ;
165+
160166 return this ->gameEvent ->GetUint64 (key.c_str ());
161167}
162168
@@ -167,6 +173,8 @@ float PluginEvent::GetFloat(std::string key)
167173 if (!this ->gameEvent )
168174 return 0 .0f ;
169175
176+ if (!this ->gameEvent ->HasKey (key.c_str ())) return 0 .0f ;
177+
170178 return this ->gameEvent ->GetFloat (key.c_str ());
171179}
172180
@@ -177,6 +185,8 @@ std::string PluginEvent::GetString(std::string key)
177185 if (!this ->gameEvent )
178186 return " " ;
179187
188+ if (!this ->gameEvent ->HasKey (key.c_str ())) return " " ;
189+
180190 return this ->gameEvent ->GetString (key.c_str ());
181191}
182192
You can’t perform that action at this time.
0 commit comments