chiark / gitweb /
bus: driverd: don't attempt to remove from empty list
[elogind.git] / src / bus-driverd / bus-driverd.c
index 57023ec8773205ddad60680c00e90ef95b24bde0..f8a123d4f118d290ae73005648c435f503d5ac35 100644 (file)
@@ -90,10 +90,10 @@ static void match_free(Match *m) {
                 Match *first;
 
                 first = hashmap_get(m->client->matches, m->match);
-                LIST_REMOVE(matches, first, m);
-                if (first)
+                if (first) {
+                        LIST_REMOVE(matches, first, m);
                         assert_se(hashmap_replace(m->client->matches, m->match, first) >= 0);
-                else
+                else
                         hashmap_remove(m->client->matches, m->match);
 
                 m->client->n_matches--;
@@ -346,7 +346,7 @@ static int driver_remove_match(sd_bus *bus, sd_bus_message *message, void *userd
 
         m = hashmap_get(c->matches, normalized);
         if (!m) {
-                r = sd_bus_error_setf(error, SD_BUS_ERROR_MATCH_RULE_NOT_FOUND, "Match rule \"%s\" not found.");
+                r = sd_bus_error_setf(error, SD_BUS_ERROR_MATCH_RULE_NOT_FOUND, "Match rule \"%s\" not found.", normalized);
                 goto finish;
         }