XSPICE d_source: prevent a crash when the input file is not found
This commit is contained in:
parent
b24be62bf0
commit
39defa3fa7
|
|
@ -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…
Reference in New Issue