aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib/mm-location-gps-nmea.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-06-29 10:06:18 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-06-29 08:53:00 +0000
commit619b054e5c874844a73594a724b4e5ce5ec18b6d (patch)
tree9ceaedc6f9b27548c40deba584c83d93fd5e21af /libmm-glib/mm-location-gps-nmea.c
parent60211b51b112db23c07dfd62dd6336a964a287e0 (diff)
libmm-glib,location: avoid warnings when no traces available
ModemManager[201411]: <debug> [1593417744.011884] [modem0/ttyUSB1/gps] <-- '$GPVTG,,T,,M,,N,,K,N*2C<CR><LF>$GPGSA,A,1,,,,,,,,,,,,,,,*1E<CR><LF>$GPGGA,,,,,,0,,,,,,,,*66<CR><LF>$GPRMC,,V,,,,,,,,,,N*53<CR><LF>' (ModemManager:201411): GLib-CRITICAL **: 10:02:24.054: g_strjoinv: assertion 'str_array != NULL' failed Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff7832473 in g_logv () from /usr/lib/libglib-2.0.so.0 (gdb) bt #0 0x00007ffff7832473 in g_logv () at /usr/lib/libglib-2.0.so.0 #1 0x00007ffff78326f0 in g_log () at /usr/lib/libglib-2.0.so.0 #2 0x00007ffff7846b5e in g_strjoinv () at /usr/lib/libglib-2.0.so.0 #3 0x00007ffff7ee9663 in mm_location_gps_nmea_get_string_variant (self=0x5555557dde50) at mm-location-gps-nmea.c:246 #4 0x00005555555e7c47 in build_location_dictionary (previous=0x0, location_3gpp=0x55555573e660, location_gps_nmea=0x5555557dde50, location_gps_raw=0x0, location_cdma_bs=0x0) at mm-iface-modem-location.c:183 ... (gdb) fr 3 #3 0x00007ffff7ee9663 in mm_location_gps_nmea_get_string_variant (self=0x5555557dde50) at mm-location-gps-nmea.c:246 246 built = g_strjoinv ("\r\n", traces); (gdb) p traces $1 = (GStrv) 0x0
Diffstat (limited to 'libmm-glib/mm-location-gps-nmea.c')
-rw-r--r--libmm-glib/mm-location-gps-nmea.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libmm-glib/mm-location-gps-nmea.c b/libmm-glib/mm-location-gps-nmea.c
index fde811fe..22e7ab46 100644
--- a/libmm-glib/mm-location-gps-nmea.c
+++ b/libmm-glib/mm-location-gps-nmea.c
@@ -243,8 +243,9 @@ mm_location_gps_nmea_get_string_variant (MMLocationGpsNmea *self)
g_return_val_if_fail (MM_IS_LOCATION_GPS_NMEA (self), NULL);
traces = mm_location_gps_nmea_get_traces (self);
- built = g_strjoinv ("\r\n", traces);
- return g_variant_ref_sink (g_variant_new_string (built));
+ if (traces)
+ built = g_strjoinv ("\r\n", traces);
+ return g_variant_ref_sink (g_variant_new_string (built ? built : ""));
}
/*****************************************************************************/