From 47a7069c143c0f6a1219a1cef78a51d0f31f0710 Mon Sep 17 00:00:00 2001
From: Dylan Van Assche <me@dylanvanassche.be>
Date: Wed, 12 May 2021 18:25:40 +0200
Subject: [PATCH 6/8] at: log expected result before setting it to NULL

Otherwise the log contains NULL instead of the expected value, making it hard to debug
---
 src/at.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/at.c b/src/at.c
index 1e605a1..533ed1c 100644
--- a/src/at.c
+++ b/src/at.c
@@ -141,9 +141,9 @@ void at_process_result(struct EG25Manager *manager,
     if (at_cmd->expected && !strstr(response, at_cmd->expected)) {
         g_free(at_cmd->value);
         at_cmd->value = at_cmd->expected;
-        at_cmd->expected = NULL;
         g_message("Got a different result than expected, changing value...");
-        g_message("\t%s\n\t%s", at_cmd->expected, response);
+        g_message("Expected: [%s]\nResponse: [%s]", at_cmd->expected, response);
+        at_cmd->expected = NULL;
         at_send_command(manager);
     } else {
         at_next_command(manager);
-- 
2.31.1

