diff options
Diffstat (limited to 'odb/qt/basic/mysql/qstring-traits.hxx')
-rw-r--r-- | odb/qt/basic/mysql/qstring-traits.hxx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/odb/qt/basic/mysql/qstring-traits.hxx b/odb/qt/basic/mysql/qstring-traits.hxx index 922c4c3..8596d37 100644 --- a/odb/qt/basic/mysql/qstring-traits.hxx +++ b/odb/qt/basic/mysql/qstring-traits.hxx @@ -45,15 +45,18 @@ namespace odb bool& is_null, const QString& v) { - is_null = false; - - const QByteArray& a (v.toUtf8 ()); - n = static_cast<std::size_t> (a.size ()); + if (v.isNull ()) + is_null = true; + else + { + const QByteArray& a (v.toUtf8 ()); + n = static_cast<std::size_t> (a.size ()); - if (n > b.capacity ()) - b.capacity (n); + if (n > b.capacity ()) + b.capacity (n); - std::memcpy (b.data (), a.data (), n); + std::memcpy (b.data (), a.data (), n); + } } }; |