Skip to content

Commit

Permalink
fix null pointer dereference
Browse files Browse the repository at this point in the history
when routing service initialization fails and some database
handlers are not initialized properly yet
  • Loading branch information
Karry committed Apr 11, 2024
1 parent 457317c commit 6b73325
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libosmscout/src/osmscout/routing/MultiDBRoutingService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,14 @@ namespace osmscout {
}

for (auto& handle : handles) {
handle.routingDatabase->Close();
handle.routingDatabase.reset();
handle.router->Close();
handle.router.reset();
if (handle.routingDatabase) {
handle.routingDatabase->Close();
handle.routingDatabase.reset();
}
if (handle.router) {
handle.router->Close();
handle.router.reset();
}
handle.profile.reset();
}

Expand Down

0 comments on commit 6b73325

Please sign in to comment.