diff options
-rw-r--r-- | platform/qt/src/sqlite3.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/qt/src/sqlite3.cpp b/platform/qt/src/sqlite3.cpp index 6ed55c541f..0cd78d85ce 100644 --- a/platform/qt/src/sqlite3.cpp +++ b/platform/qt/src/sqlite3.cpp @@ -11,6 +11,7 @@ #include <cstring> #include <cstdio> #include <chrono> +#include <limits> #include <mbgl/util/chrono.hpp> #include <mbgl/util/logging.hpp> @@ -141,7 +142,11 @@ Database::~Database() { void Database::setBusyTimeout(std::chrono::milliseconds timeout) { assert(impl); - std::string timeoutStr = mbgl::util::toString(timeout.count()); + + // std::chrono::milliseconds.count() is a long and Qt will cast + // internally to int, so we need to make sure the limits apply. + std::string timeoutStr = mbgl::util::toString(timeout.count() & INT_MAX); + QString connectOptions = impl->db->connectOptions(); if (connectOptions.isEmpty()) { if (!connectOptions.isEmpty()) connectOptions.append(';'); |