From 5d64292ed83b9423fdd6fbd2fb6a749e1999a695 Mon Sep 17 00:00:00 2001 From: Dmytro <121412908+dmaslenko@users.noreply.github.com> Date: Sat, 6 Jan 2024 10:58:56 -0800 Subject: [PATCH] Fix dangling reference (#10135) --- src/cli/Remove.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/Remove.cpp b/src/cli/Remove.cpp index f383d1636..906a81410 100644 --- a/src/cli/Remove.cpp +++ b/src/cli/Remove.cpp @@ -35,7 +35,7 @@ int Remove::executeWithDatabase(QSharedPointer database, QSharedPointe auto& out = parser->isSet(Command::QuietOption) ? Utils::DEVNULL : Utils::STDOUT; auto& err = Utils::STDERR; - auto& entryPath = parser->positionalArguments().at(1); + auto entryPath = parser->positionalArguments().at(1); QPointer entry = database->rootGroup()->findEntryByPath(entryPath); if (!entry) { err << QObject::tr("Entry %1 not found.").arg(entryPath) << endl; @@ -50,7 +50,7 @@ int Remove::executeWithDatabase(QSharedPointer database, QSharedPointe recycled = false; } else { database->recycleEntry(entry); - }; + } QString errorMessage; if (!database->save(Database::Atomic, {}, &errorMessage)) {