Fix crash in owmn previous commit.

This commit is contained in:
Bastien Montagne 2018-06-05 17:51:17 +02:00
parent 481cdb08ed
commit 1628a6858e
1 changed files with 4 additions and 2 deletions

View File

@ -656,7 +656,7 @@ int wm_homefile_read(
bool use_factory_settings, bool use_empty_data, bool use_userdef,
const char *filepath_startup_override, const char *app_template_override)
{
Main *bmain = CTX_data_main(C);
Main *bmain = G.main; /* Context does not always have valid main pointer here... */
ListBase wmbase;
bool success = false;
@ -848,9 +848,11 @@ int wm_homefile_read(
* can remove this eventually, only in a 2.53 and older, now its not written */
G.fileflags &= ~G_FILE_RELATIVE_REMAP;
bmain = CTX_data_main(C);
if (use_userdef) {
/* check userdef before open window, keymaps etc */
wm_init_userdef(CTX_data_main(C), read_userdef_from_memory);
wm_init_userdef(bmain, read_userdef_from_memory);
}
/* match the read WM with current WM */