summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-10 03:26:34 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-10 03:26:36 +0200
commit756fb30c8abeb14bcde6b6bf8dfc50554f0838bd (patch)
treedb05821a48ed9ad29ef624cdad5c5ba40b2b593b
parenta6ba6a370b130942441a33545e46e992286549f2 (diff)
gsm_trx_name(): don't break if trx is NULL
Just as a general precaution deemed to fit such a convenience function that lives in libcommon, no actual failure observed. Change-Id: I8e77fe1abc402469fd037e2fde2f46e2c8114f59
-rw-r--r--openbsc/src/libcommon/gsm_data_shared.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index 4eea21e7b..b8853ad69 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -328,8 +328,11 @@ static char ts2str[255];
char *gsm_trx_name(const struct gsm_bts_trx *trx)
{
- snprintf(ts2str, sizeof(ts2str), "(bts=%d,trx=%d)",
- trx->bts->nr, trx->nr);
+ if (!trx)
+ snprintf(ts2str, sizeof(ts2str), "(trx=NULL)");
+ else
+ snprintf(ts2str, sizeof(ts2str), "(bts=%d,trx=%d)",
+ trx->bts->nr, trx->nr);
return ts2str;
}