mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Merge pull request #106089 from mihe/rogue-newlines
Fix empty lines being added for errors with no script backtrace
This commit is contained in:
@@ -88,7 +88,9 @@ void Logger::log_error(const char *p_function, const char *p_file, int p_line, c
|
||||
logf_error(" at: %s (%s:%i)\n", p_function, p_file, p_line);
|
||||
|
||||
for (const Ref<ScriptBacktrace> &backtrace : p_script_backtraces) {
|
||||
logf_error("%s\n", backtrace->format(3).utf8().get_data());
|
||||
if (!backtrace->is_empty()) {
|
||||
logf_error("%s\n", backtrace->format(3).utf8().get_data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ void ScriptBacktrace::_store_variables(const List<String> &p_names, const List<V
|
||||
void ScriptBacktrace::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_language_name"), &ScriptBacktrace::get_language_name);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_empty"), &ScriptBacktrace::is_empty);
|
||||
ClassDB::bind_method(D_METHOD("get_frame_count"), &ScriptBacktrace::get_frame_count);
|
||||
ClassDB::bind_method(D_METHOD("get_frame_function", "index"), &ScriptBacktrace::get_frame_function);
|
||||
ClassDB::bind_method(D_METHOD("get_frame_file", "index"), &ScriptBacktrace::get_frame_file);
|
||||
@@ -173,7 +174,7 @@ Variant ScriptBacktrace::get_member_variable_value(int p_frame_index, int p_vari
|
||||
}
|
||||
|
||||
String ScriptBacktrace::format(int p_indent_all, int p_indent_frames) const {
|
||||
if (stack_frames.is_empty()) {
|
||||
if (is_empty()) {
|
||||
return String();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
|
||||
String get_language_name() const { return language_name; }
|
||||
|
||||
bool is_empty() const { return stack_frames.is_empty(); }
|
||||
int get_frame_count() const { return stack_frames.size(); }
|
||||
String get_frame_function(int p_index) const;
|
||||
String get_frame_file(int p_index) const;
|
||||
|
||||
Reference in New Issue
Block a user