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
This commit is contained in:
@@ -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 : ""));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user