Fix #111355: Crash when calling operator 'TEXT_OT_save'
Crash occurs when calling with `EXEC_DEFAULT` context. In this case `text->filepath` might be `nullptr` and cause a crash. Fix by raising a Python error message in this case.
This commit is contained in:
@@ -607,6 +607,11 @@ static void txt_write_file(Main *bmain, Text *text, ReportList *reports)
|
||||
BLI_stat_t st;
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
if (text->filepath == nullptr) {
|
||||
BKE_reportf(reports, RPT_ERROR, "No file path for \"%s\"", text->id.name + 2);
|
||||
return;
|
||||
}
|
||||
|
||||
STRNCPY(filepath, text->filepath);
|
||||
BLI_path_abs(filepath, BKE_main_blendfile_path(bmain));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user