mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-02 22:35:55 +01:00
Errors: Fallback to fprintf
if OS
singleton doesn't exist
Otherwise we would crash if something prints an error before init or after destruction of the `OS` singleton which handles printing/logging. (cherry picked from commit c83084fccb4cdc42d2ca324c974ace0cf974630d)
This commit is contained in:
parent
8e9782ac76
commit
c2d36b2c34
@ -74,7 +74,13 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, ErrorHandlerType p_type) {
|
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, ErrorHandlerType p_type) {
|
||||||
OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, p_message, (Logger::ErrorType)p_type);
|
if (OS::get_singleton()) {
|
||||||
|
OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, p_message, (Logger::ErrorType)p_type);
|
||||||
|
} else {
|
||||||
|
// Fallback if errors happen before OS init or after it's destroyed.
|
||||||
|
const char *err_details = (p_message && *p_message) ? p_message : p_error;
|
||||||
|
fprintf(stderr, "ERROR: %s\n at: %s (%s:%i)\n", err_details, p_function, p_file, p_line);
|
||||||
|
}
|
||||||
|
|
||||||
_global_lock();
|
_global_lock();
|
||||||
ErrorHandlerList *l = error_handler_list;
|
ErrorHandlerList *l = error_handler_list;
|
||||||
|
Loading…
Reference in New Issue
Block a user