Browse Source

Merge pull request #35218 from bojidar-bg/26691-parse-error-errors

Fix errors raised when showing parse errors in the editor
Rémi Verschelde 5 years ago
parent
commit
8b0e2a409b
2 changed files with 4 additions and 2 deletions
  1. 1 1
      modules/gdscript/gdscript.cpp
  2. 3 1
      modules/gdscript/gdscript_editor.cpp

+ 1 - 1
modules/gdscript/gdscript.cpp

@@ -320,7 +320,7 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
 		if (!ClassDB::is_parent_class(p_this->get_class_name(), top->native->get_name())) {
 		if (!ClassDB::is_parent_class(p_this->get_class_name(), top->native->get_name())) {
 
 
 			if (ScriptDebugger::get_singleton()) {
 			if (ScriptDebugger::get_singleton()) {
-				GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 0, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
+				GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
 			}
 			}
 			ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
 			ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
 		}
 		}

+ 3 - 1
modules/gdscript/gdscript_editor.cpp

@@ -335,7 +335,9 @@ void GDScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *
 
 
 ScriptInstance *GDScriptLanguage::debug_get_stack_level_instance(int p_level) {
 ScriptInstance *GDScriptLanguage::debug_get_stack_level_instance(int p_level) {
 
 
-	ERR_FAIL_COND_V(_debug_parse_err_line >= 0, NULL);
+	if (_debug_parse_err_line >= 0)
+		return NULL;
+
 	ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, NULL);
 	ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, NULL);
 
 
 	int l = _debug_call_stack_pos - p_level - 1;
 	int l = _debug_call_stack_pos - p_level - 1;