Skip to content

Commit

Permalink
itemencrypt: Fix saving empty encrypted tab (#2436)
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Aug 22, 2023
1 parent f627d2a commit d92c62c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions plugins/itemencrypted/itemencrypted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,6 @@ ItemEncrypted::ItemEncrypted(QWidget *parent)
bool ItemEncryptedSaver::saveItems(const QString &, const QAbstractItemModel &model, QIODevice *file)
{
const auto length = model.rowCount();
if (length == 0)
return false; // No need to encode empty tab.

QByteArray bytes;

{
Expand Down Expand Up @@ -720,7 +717,7 @@ ItemSaverPtr ItemEncryptedLoader::loadItems(const QString &, QAbstractItemModel

quint64 length;
stream2 >> length;
if ( length <= 0 || stream2.status() != QDataStream::Ok ) {
if ( length < 0 || stream2.status() != QDataStream::Ok ) {

Check warning on line 720 in plugins/itemencrypted/itemencrypted.cpp

View workflow job for this annotation

GitHub Actions / Linux-GCC

comparison of unsigned expression < 0 is always false [-Wtype-limits]

Check warning on line 720 in plugins/itemencrypted/itemencrypted.cpp

View workflow job for this annotation

GitHub Actions / Qt 6

comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
emitDecryptFailed();
COPYQ_LOG("ItemEncrypt ERROR: Failed to parse item count!");
return nullptr;
Expand Down

0 comments on commit d92c62c

Please sign in to comment.