mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-04 17:17:47 +08:00
Fixed "UNIQUE constraint failed: Statistics.id" error when loading a previous map with last id saved in Statistics not in Node table (this happened when ignored locations are not saved to database).
This commit is contained in:
@@ -783,6 +783,15 @@ void DBDriver::getLastNodeId(int & id) const
|
||||
|
||||
_dbSafeAccessMutex.lock();
|
||||
this->getLastIdQuery("Node", id);
|
||||
int statisticsId = 0;
|
||||
if(uStrNumCmp(this->getDatabaseVersion(), "0.11.11") >= 0)
|
||||
{
|
||||
this->getLastIdQuery("Statistics", statisticsId);
|
||||
if(statisticsId > id)
|
||||
{
|
||||
id = statisticsId;
|
||||
}
|
||||
}
|
||||
_dbSafeAccessMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user