aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_ss7.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo_ss7.c')
-rw-r--r--src/osmo_ss7.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index eb5a4ef..6db3f14 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -247,10 +247,16 @@ err:
const char *_osmo_ss7_pointcode_print(char *buf, size_t len, struct osmo_ss7_instance *inst, uint32_t pc)
{
- const struct osmo_ss7_pc_fmt *pc_fmt = inst ? &inst->cfg.pc_fmt : &default_pc_fmt;
- unsigned int num_comp_exp = num_pc_comp_exp(pc_fmt);
- const char *fmtstr = gen_pc_fmtstr(pc_fmt, &num_comp_exp);
+ const struct osmo_ss7_pc_fmt *pc_fmt;
+ unsigned int num_comp_exp;
+ const char *fmtstr;
+
+ if (!osmo_ss7_pc_is_valid(pc))
+ return "(no PC)";
+ pc_fmt = inst ? &inst->cfg.pc_fmt : &default_pc_fmt;
+ num_comp_exp = num_pc_comp_exp(pc_fmt);
+ fmtstr = gen_pc_fmtstr(pc_fmt, &num_comp_exp);
OSMO_ASSERT(fmtstr);
snprintf(buf, len, fmtstr,
pc_comp_shift_and_mask(pc_fmt, 0, pc),