diff options
Diffstat (limited to 'common/synchronizerstore.cpp')
-rw-r--r-- | common/synchronizerstore.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common/synchronizerstore.cpp b/common/synchronizerstore.cpp index a9da2fe..31c1391 100644 --- a/common/synchronizerstore.cpp +++ b/common/synchronizerstore.cpp | |||
@@ -117,13 +117,20 @@ void SynchronizerStore::writeValue(const QByteArray &prefix, const QByteArray &k | |||
117 | 117 | ||
118 | void SynchronizerStore::removeValue(const QByteArray &prefix, const QByteArray &key) | 118 | void SynchronizerStore::removeValue(const QByteArray &prefix, const QByteArray &key) |
119 | { | 119 | { |
120 | mTransaction.openDatabase("values").remove(prefix + key, [&](const Sink::Storage::DataStore::Error &error) { | 120 | auto assembled = prefix + key; |
121 | if (assembled.isEmpty()) { | ||
122 | return; | ||
123 | } | ||
124 | mTransaction.openDatabase("values").remove(assembled, [&](const Sink::Storage::DataStore::Error &error) { | ||
121 | SinkWarning() << "Failed to remove the value: " << prefix + key << error; | 125 | SinkWarning() << "Failed to remove the value: " << prefix + key << error; |
122 | }); | 126 | }); |
123 | } | 127 | } |
124 | 128 | ||
125 | void SynchronizerStore::removePrefix(const QByteArray &prefix) | 129 | void SynchronizerStore::removePrefix(const QByteArray &prefix) |
126 | { | 130 | { |
131 | if (prefix.isEmpty()) { | ||
132 | return; | ||
133 | } | ||
127 | //FIXME remove all values matching prefix | 134 | //FIXME remove all values matching prefix |
128 | // mTransaction.openDatabase("values").remove(prefix, [](const Sink::Storage::DataStore::Error &) { | 135 | // mTransaction.openDatabase("values").remove(prefix, [](const Sink::Storage::DataStore::Error &) { |
129 | // //Ignore errors because we may not find the value | 136 | // //Ignore errors because we may not find the value |