Prevent crashes when nodes or tables are not available,

e.g. due to missing input file.
This commit is contained in:
Holger Vogt 2022-08-31 15:43:20 +02:00
parent bfab06e04b
commit 04ded78ef6
2 changed files with 10 additions and 5 deletions

View File

@ -270,15 +270,19 @@ static struct dvec* findvec_alle(void) {
int i, num_nodes;
Evt_Node_Info_t** node_table;
/* Look for node name in the event-driven node list */
num_nodes = g_mif_info.ckt->evt->counts.num_nodes;
node_table = g_mif_info.ckt->evt->info.node_table;
if (num_nodes == 0 || !node_table)
return NULL;
/* We need to create a new plot because of veccmp() is used */
struct plot* pl = plot_alloc("digi");
pl->pl_title = copy("DigitalData");
pl->pl_name = copy("digital");
pl->pl_date = copy(datestring());
plot_new(pl);
/* Look for node name in the event-driven node list */
num_nodes = g_mif_info.ckt->evt->counts.num_nodes;
node_table = g_mif_info.ckt->evt->info.node_table;
/* find all event data, create vectors, link them to v_link2 */
for (i = 0; i < num_nodes; i++) {
char* name = node_table[i]->name;

View File

@ -408,11 +408,12 @@ EVTdisplay(wordlist *wl)
}
node = ckt->evt->info.node_list;
node_table = ckt->evt->info.node_table;
out_init();
if (!node) {
if (!node || !node_table) {
out_printf("No event node available!\n");
return;
}
out_init();
if (ckt->evt->jobs.job_plot) {
out_printf("\nList of event nodes in plot %s\n",
ckt->evt->jobs.job_plot[ckt->evt->jobs.cur_job]);