diff --git a/qasecretservice.cpp b/qasecretservice.cpp index b4ceb88..6712e83 100644 --- a/qasecretservice.cpp +++ b/qasecretservice.cpp @@ -10,9 +10,11 @@ QByteArray QuasarAppUtils::QASecretService::getByAlias(const QString &alias) { proc.start(); - proc.waitForFinished(2000); + if (!proc.waitForFinished(2000)) { + return ""; + } - if (proc.error() || proc.exitCode()) { + if (proc.exitCode()) { return ""; } @@ -30,13 +32,16 @@ QByteArray QuasarAppUtils::QASecretService::getByHash(const QByteArray &hash) proc.start(); - proc.waitForFinished(2000); - QByteArray result = proc.readAllStandardOutput(); - - if (proc.error() || proc.exitCode()) { + if (!proc.waitForFinished(2000)) { return ""; } + if (proc.exitCode()) { + return ""; + } + + QByteArray result = proc.readAllStandardOutput(); + // drop \n return result.left(result.size() - 1); }