summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-21 10:56:26 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-21 10:56:55 +0100
commit2a22d346dc66eb5532cdd438b052acfb1a5970cb (patch)
tree06d96fb300165df46b9e75415fea00f618bb5bb2
parent3b3e7d3f463e7e0854fa10f04c044aa2a61594ae (diff)
downloadserenity-2a22d346dc66eb5532cdd438b052acfb1a5970cb.zip
utmpupdate: Don't complain about an error if the utmp is just empty
This removes a misleading error message during startup.
-rw-r--r--Userland/Utilities/utmpupdate.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Utilities/utmpupdate.cpp b/Userland/Utilities/utmpupdate.cpp
index c055559b7e..cb18839f7b 100644
--- a/Userland/Utilities/utmpupdate.cpp
+++ b/Userland/Utilities/utmpupdate.cpp
@@ -80,10 +80,12 @@ int main(int argc, char** argv)
JsonObject json;
- if (!previous_json.has_value() || !previous_json.value().is_object()) {
- dbgln("Error: Could not parse JSON");
- } else {
- json = previous_json.value().as_object();
+ if (!file_contents.is_empty()) {
+ if (!previous_json.has_value() || !previous_json.value().is_object()) {
+ dbgln("Error: Could not parse JSON");
+ } else {
+ json = previous_json.value().as_object();
+ }
}
if (flag_create) {