Fix crash: mouse is over file space during startup.

When blender starts and the mouse is over a file/asset browser it
crashes. This is because blender wants to highlight a file, but the
layout isn't initialized yet.
This commit is contained in:
Jeroen Bakker 2021-08-10 12:00:27 +02:00
parent 895d3cd11e
commit aab7540b7a
1 changed files with 3 additions and 1 deletions

View File

@ -1366,7 +1366,9 @@ int file_highlight_set(SpaceFile *sfile, ARegion *region, int mx, int my)
FileSelectParams *params;
int numfiles, origfile;
if (sfile == NULL || sfile->files == NULL) {
/* In case blender starts where the mouse is over a File broser, this operator can be invoked
* when the sfile or sfile->layout isn't initialized yet. */
if (sfile == NULL || sfile->files == NULL || sfile->layout == NULL) {
return 0;
}