From f0a2d609066d8ba45f9e03f16950669ecdf590d3 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 15 Sep 2018 18:42:14 +0200 Subject: [PATCH] cli: Abort editing config if nothing has changed --- cli/application.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/application.cpp b/cli/application.cpp index ebf2d83..e707e23 100644 --- a/cli/application.cpp +++ b/cli/application.cpp @@ -766,6 +766,10 @@ QByteArray Application::editConfigViaEditor() const cerr << Phrases::Error << "New config object seems empty." << Phrases::EndFlush; return QByteArray(); } + if (configObj == m_connection.rawConfig()) { + cerr << Phrases::Warning << "Editing aborted; config hasn't changed." << Phrases::EndFlush; + return QByteArray(); + } for (const auto &arrayName : { QStringLiteral("devices"), QStringLiteral("folders") }) { if (!configObj.value(arrayName).isArray()) { cerr << Phrases::Error << "Array \"" << arrayName.toLocal8Bit().data() << "\" is not present." << Phrases::EndFlush;