Skip to content

Commit

Permalink
Fixed potential crash when handling file reloads
Browse files Browse the repository at this point in the history
A crash could occur if a file (usually a map, tileset or world) got
reloaded while no editor was currently open.
  • Loading branch information
bjorn committed Jan 24, 2025
1 parent aca6370 commit 116f3ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tiled/documentmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,10 @@ bool DocumentManager::reloadDocument(Document *document)
break;
}

if (!isDocumentChangedOnDisk(currentDocument()))
mFileChangedWarning->setVisible(false);
// We may need to hide the file changed warning
if (auto current = currentDocument())
if (!isDocumentChangedOnDisk(current))
mFileChangedWarning->setVisible(false);

emit documentReloaded(document);

Expand Down

0 comments on commit 116f3ba

Please sign in to comment.