diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-10 18:49:38 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2020-12-10 18:49:38 +0000 |
commit | 5668c19ca0dcc328e1a45b152f9d4d202767dac0 (patch) | |
tree | c9e0ec29ad0db6c9c9b7247506820abc1723698b | |
parent | Remove unreachable code (diff) | |
download | libdbpp-mysql-5668c19ca0dcc328e1a45b152f9d4d202767dac0.tar.bz2 libdbpp-mysql-5668c19ca0dcc328e1a45b152f9d4d202767dac0.tar.xz libdbpp-mysql-5668c19ca0dcc328e1a45b152f9d4d202767dac0.zip |
Add check that upload ctx is non-null
-rw-r--r-- | libmysqlpp/my-connection.cpp | 6 |
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; |