diff options
author | Teemu Ikonen <tpikonen@mailbox.org> | 2023-07-08 13:59:43 +0300 |
---|---|---|
committer | Teemu Ikonen <tpikonen@mailbox.org> | 2023-07-22 08:57:13 +0000 |
commit | fa70e7434c1472841ced848503380f64c8728ee4 (patch) | |
tree | 05375e705f08efdb3d611a58a71e476d6329c400 | |
parent | 45752c02c4817e32ae0f49b872bf7c0247b3a44c (diff) |
nmea-source: Don't disconnect when receiving an empty message
Convert a NULL message received without an error to an empty string and
keep on listening to the NMEA source.
See https://gitlab.gnome.org/GNOME/glib/-/issues/655
-rw-r--r-- | src/gclue-nmea-source.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gclue-nmea-source.c b/src/gclue-nmea-source.c index 8ea8bae..0838115 100644 --- a/src/gclue-nmea-source.c +++ b/src/gclue-nmea-source.c @@ -730,13 +730,18 @@ on_read_nmea_sentence (GObject *object, g_warning ("Error when receiving message: %s", error->message); } + service_broken (source); + return; } else { - g_debug ("NMEA nothing to read"); + g_debug ("NMEA empty read"); + /* GLib has a bug where g_data_input_stream_read_upto_finish + * returns NULL when reading a line with only stop chars. + * Convert this NULL to a zero-length message. See: + * https://gitlab.gnome.org/GNOME/glib/-/issues/655 + */ + message = g_strdup (""); } - service_broken (source); - - return; } g_debug ("Network source sent: \"%s\"", message); |