vty/osmo_counter: use name if description is NULL

`show stats` shows (null) for osmocom_counters when
description is null.

OpenBSC> show  stats
Ungrouped counters:
 (null):        4

Change-Id: I553b88a6fca688924b1f2b49e8cb17e90f057bb1
This commit is contained in:
Alexander Couzens 2016-10-04 11:24:02 +02:00 committed by Harald Welte
parent a23817622b
commit 3e432e1912
1 changed files with 5 additions and 1 deletions

View File

@ -159,9 +159,13 @@ static int handle_counter(struct osmo_counter *counter, void *vctx_)
{
struct vty_out_context *vctx = vctx_;
struct vty *vty = vctx->vty;
const char *description = counter->description;
if (!counter->description)
description = counter->name;
vty_out(vty, " %s%s: %8lu%s",
vctx->prefix, counter->description,
vctx->prefix, description,
osmo_counter_get(counter), VTY_NEWLINE);
return 0;