소스 검색

Corrected a compile warning
* Follow up to a15661e.

aleos89 8 년 전
부모
커밋
900548f34b
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      src/map/script.c

+ 9 - 0
src/map/script.c

@@ -6709,6 +6709,15 @@ static int script_getitem_randomoption(struct script_state *st, struct item *it,
 	opt_val_n = script_array_highest_key(st, NULL, opt_val_var, opt_val_ref);
 	opt_param_n = script_array_highest_key(st, NULL, opt_param_var, opt_param_ref);
 
+	if (opt_val_n < 1) {
+		ShowError("buildin_%s: No option value listed.\n", funcname);
+		return SCRIPT_CMD_FAILURE;
+	}
+	if (opt_param_n < 1) {
+		ShowError("buildin_%s: No option parameter listed.\n";, funcname);
+		return SCRIPT_CMD_FAILURE;
+	}
+
 	opt_id_id = reference_getid(opt_id);
 	opt_val_id = reference_getid(opt_val);
 	opt_param_id = reference_getid(opt_param);