Prechádzať zdrojové kódy

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 13 rokov pred
rodič
commit
642584042e
1 zmenil súbory, kde vykonal 4 pridanie a 1 odobranie
  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;