NavCache: fix writes to a read-only DB
When in read-only mode, we were still allowing writes during the octree building, which is bad. Add the missing check. Sentry-Id: FLIGHTGEAR-8F
This commit is contained in:
parent
4075ea02e9
commit
e028c52e42
1 changed files with 5 additions and 1 deletions
|
@ -265,7 +265,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int openFlags = readOnly ? SQLITE_OPEN_READONLY :
|
int openFlags = readOnly ? SQLITE_OPEN_READONLY :
|
||||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
|
(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
|
||||||
std::string pathUtf8 = path.utf8Str();
|
std::string pathUtf8 = path.utf8Str();
|
||||||
int result = sqlite3_open_v2(pathUtf8.c_str(), &db, openFlags, NULL);
|
int result = sqlite3_open_v2(pathUtf8.c_str(), &db, openFlags, NULL);
|
||||||
if (result == SQLITE_MISUSE) {
|
if (result == SQLITE_MISUSE) {
|
||||||
|
@ -2032,6 +2032,10 @@ int NavDataCache::getOctreeBranchChildren(int64_t octreeNodeId)
|
||||||
|
|
||||||
void NavDataCache::defineOctreeNode(Octree::Branch* pr, Octree::Node* nd)
|
void NavDataCache::defineOctreeNode(Octree::Branch* pr, Octree::Node* nd)
|
||||||
{
|
{
|
||||||
|
if (isReadOnly()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sqlite3_bind_int64(d->insertOctree, 1, nd->guid());
|
sqlite3_bind_int64(d->insertOctree, 1, nd->guid());
|
||||||
d->execInsert(d->insertOctree);
|
d->execInsert(d->insertOctree);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue