Fix T90341: Crash opening 2.4 file with File Browser editor open

The file selection parameters (e.g. `context.space_data.params`) are
expected to be unset in certain cases. Reading 2.4 files seems to be one
of them. Hence, code using it should check it's set first. Also added an
assert to a File Browser UI template printing a message when the
parameters are unset, to help debugging the issue.
This commit is contained in:
2021-08-03 12:10:26 +02:00
parent b1a607ce04
commit c0900a64ce
2 changed files with 8 additions and 0 deletions

View File

@@ -82,6 +82,9 @@ void ED_file_path_button(bScreen *screen,
PointerRNA params_rna_ptr;
uiBut *but;
BLI_assert_msg(params != NULL,
"File select parameters not set. The caller is expected to check this.");
RNA_pointer_create(&screen->id, &RNA_FileSelectParams, params, &params_rna_ptr);
/* callbacks for operator check functions */