Skip to content

Commit

Permalink
cli: Abort editing config if nothing has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Sep 15, 2018
1 parent 3731933 commit f0a2d60
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f0a2d60

Please sign in to comment.