Allow maxord=1 w/o crash

This commit is contained in:
dwarning 2010-10-31 17:42:46 +00:00
parent 7b3960506f
commit a5bfc9d6bd
2 changed files with 44 additions and 44 deletions

View File

@ -68,7 +68,7 @@ CKTsetup(CKTcircuit *ckt)
if(error) return(error);
}
}
for(i=0;i<=ckt->CKTmaxOrder+1;i++) {
for(i=0;i<=MAX(2,ckt->CKTmaxOrder)+1;i++) { /* dctran needs 3 states as minimum */
CKALLOC(ckt->CKTstates[i],ckt->CKTnumStates,double);
}
#ifdef WANT_SENSE2

View File

@ -113,9 +113,9 @@ CKTsetOpt(CKTcircuit *ckt, JOB *anal, int opt, IFvalue *val)
case OPT_MAXORD:
task->TSKmaxOrder = val->iValue;
/* Check options method and maxorder for consistency */
if (task->TSKmaxOrder < 2) {
task->TSKmaxOrder = 2;
fprintf(stderr,"\nWarning -- Option maxord < 2 not allowed in ngspice\nSet to 2\n\n");
if (task->TSKmaxOrder < 1) {
task->TSKmaxOrder = 1;
fprintf(stderr,"\nWarning -- Option maxord < 1 not allowed in ngspice\nSet to 1\n\n");
}
else if (task->TSKmaxOrder > 6) {
task->TSKmaxOrder = 6;