Browse Source

XSPICE d_source: prevent a crash when the input file is not found

pre-master-46
Holger Vogt 5 years ago
parent
commit
4ce4f52938
  1. 13
      src/xspice/icm/digital/d_source/cfunc.mod

13
src/xspice/icm/digital/d_source/cfunc.mod

@ -93,6 +93,8 @@ typedef struct {
to width*depth, one short will hold a to width*depth, one short will hold a
12-state bit description. */ 12-state bit description. */
bool init_ok; /* set to true if init is succeful */
} Local_Data_t; } Local_Data_t;
@ -1015,6 +1017,14 @@ void cm_d_source(ARGS)
/* close source file */ /* close source file */
if (source) if (source)
fclose(source); fclose(source);
if (err > 0) {
loc->init_ok = FALSE;
cm_message_send(" dsource will return only its initial state.\n");
return;
}
else
loc->init_ok = TRUE;
} }
else { /*** Retrieve previous values ***/ else { /*** Retrieve previous values ***/
@ -1024,6 +1034,9 @@ void cm_d_source(ARGS)
loc = STATIC_VAR (locdata); loc = STATIC_VAR (locdata);
if (!loc->init_ok)
return;
/* Set old values to new... */ /* Set old values to new... */
*row_index = *row_index_old; *row_index = *row_index_old;

Loading…
Cancel
Save