Explorar o código

Added error message if a script tries to access an instance variable while no instance is attached (bugreport:4962)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15089 54d463be-8e91-2dee-dedb-b68131a5f0ec
GodLesZ %!s(int64=13) %!d(string=hai) anos
pai
achega
642584042e
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      src/map/script.c

+ 4 - 1
src/map/script.c

@@ -2342,8 +2342,11 @@ void get_val(struct script_state* st, struct script_data* data)
 		case '\'':
 			{
 				struct linkdb_node** n = NULL;
-				if( st->instance_id )
+				if (st->instance_id) {
 					n = &instance[st->instance_id].svar;
+				} else {
+					ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to 0\n", name);
+				}
 				data->u.str = (char*)linkdb_search(n, (void*)reference_getuid(data));
 			}
 			break;