Skip to content

Commit

Permalink
Fixed crash after a world file failed to load
Browse files Browse the repository at this point in the history
When a world file failed to load, a missing check was causing a null
pointer to get added to the container for loaded worlds, which would
later get referenced in WorldManager::worldForMap, causing a crash.

Problem reported by email.
  • Loading branch information
bjorn committed Oct 15, 2018
1 parent ddf49d8 commit 2bdd70c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libtiled/worldmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ std::unique_ptr<World> WorldManager::privateLoadWorld(const QString &fileName,
bool WorldManager::loadWorld(const QString &fileName, QString *errorString)
{
auto world = privateLoadWorld(fileName, errorString);
if (!world)
return false;

if (mWorlds.contains(fileName))
delete mWorlds.take(fileName);
Expand Down

0 comments on commit 2bdd70c

Please sign in to comment.