summaryrefslogtreecommitdiff
path: root/libmysqlpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-12-10 18:49:38 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2020-12-10 18:49:38 +0000
commit5668c19ca0dcc328e1a45b152f9d4d202767dac0 (patch)
treec9e0ec29ad0db6c9c9b7247506820abc1723698b /libmysqlpp
parentRemove unreachable code (diff)
downloadlibdbpp-mysql-5668c19ca0dcc328e1a45b152f9d4d202767dac0.tar.bz2
libdbpp-mysql-5668c19ca0dcc328e1a45b152f9d4d202767dac0.tar.xz
libdbpp-mysql-5668c19ca0dcc328e1a45b152f9d4d202767dac0.zip
Add check that upload ctx is non-null
Diffstat (limited to 'libmysqlpp')
-rw-r--r--libmysqlpp/my-connection.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libmysqlpp/my-connection.cpp b/libmysqlpp/my-connection.cpp
index 6e4d1a1..30cef18 100644
--- a/libmysqlpp/my-connection.cpp
+++ b/libmysqlpp/my-connection.cpp
@@ -210,6 +210,9 @@ MySQL::Connection::beginBulkUpload(const char * table, const char * extra)
void
MySQL::Connection::endBulkUpload(const char * msg)
{
+ if (!ctx) {
+ throw std::logic_error("No bulk upload in progress");
+ }
ctx->loadBuf = nullptr;
ctx->loadBufLen = 0;
ctx->bufOff = msg ? -1 : 0;
@@ -228,6 +231,9 @@ MySQL::Connection::endBulkUpload(const char * msg)
size_t
MySQL::Connection::bulkUploadData(const char * data, size_t len) const
{
+ if (!ctx) {
+ throw std::logic_error("No bulk upload in progress");
+ }
ctx->loadBuf = data;
ctx->loadBufLen = len;
ctx->bufOff = 0;