osmo-sim-test: check tlv_parsed struct tp before access

The variable struct tlv_parsed tp in dump_file() conditionally
initalized by tlv_parse() but later it is accessed under a different
condition without a check that makes sure that tp is only accessed when
tlv_parse() was called beforehand. Lets introduce a check that makes
sure tp can not be accessed when it is uninitalized.

Change-Id: I6b0209b966127a4195e6f4bcb43d49387c7646ce
Fixes: CID#208435
diff --git a/utils/osmo-sim-test.c b/utils/osmo-sim-test.c
index d33f1ba..27de0bc 100644
--- a/utils/osmo-sim-test.c
+++ b/utils/osmo-sim-test.c
@@ -378,11 +378,15 @@
 		}
 		break;
 	case EF_TYPE_TRANSP:
-		if (!TLVP_PRESENT(&tp, UICC_FCP_T_FILE_SIZE))
+		if (g_class != 0xA0) {
+			if (!TLVP_PRESENT(&tp, UICC_FCP_T_FILE_SIZE))
+				goto out;
+			i = ntohs(*(uint16_t *)TLVP_VAL(&tp, UICC_FCP_T_FILE_SIZE));
+			printf("File size: %d bytes\n", i);
+		} else {
+			printf("Can not determine file size, invalid EF-type!\n");
 			goto out;
-		i = ntohs(*(uint16_t *)TLVP_VAL(&tp, UICC_FCP_T_FILE_SIZE));
-		printf("File size: %d bytes\n", i);
-
+		}
 		for (offset = 0; offset < i-1; ) {
 			uint16_t remain_len = i - offset;
 			uint16_t read_len = OSMO_MIN(remain_len, 256);