vty: Hide unconfigured BTS on 'write'

This prevents the application from crashing when there is a half
configured BTS (e.g. by using the command 'bts 1' when there isn't
a BTS 1) and the 'write' command is used.
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 5748945..55564b6 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -598,11 +598,13 @@
 	if (bts->excl_from_rf_lock)
 		vty_out(vty, "  rf-lock-exclude%s", VTY_NEWLINE);
 
-	if (bts->model->config_write_bts)
-		bts->model->config_write_bts(vty, bts);
+	if (bts->model) {
+	       if (bts->model->config_write_bts)
+		       bts->model->config_write_bts(vty, bts);
 
-	llist_for_each_entry(trx, &bts->trx_list, list)
-		config_write_trx_single(vty, trx);
+	       llist_for_each_entry(trx, &bts->trx_list, list)
+		       config_write_trx_single(vty, trx);
+	}
 }
 
 static int config_write_bts(struct vty *v)