Make osmo_apn_to_str() more robust

Previously it would crash on NULL input. Let's handle it gracefully
instead. Corresponding test case is also added.

Change-Id: I587153e49d1c92128fac3ae5c124adba9592378e
diff --git a/src/gsm/apn.c b/src/gsm/apn.c
index 8d4b2bf..f8303db 100644
--- a/src/gsm/apn.c
+++ b/src/gsm/apn.c
@@ -53,6 +53,9 @@
 	char *str = out_str;
 	size_t rest_chars = apn_enc_len;
 
+	if (!apn_enc)
+		return NULL;
+
 	while (rest_chars > 0 && apn_enc[0]) {
 		size_t label_size = apn_enc[0];
 		if (label_size + 1 > rest_chars)