fix error crash while constructing error term
This commit is contained in:
parent
ca2cd734a2
commit
703ac35735
18
C/errors.c
18
C/errors.c
|
@ -361,7 +361,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||
CELL nt[3];
|
||||
Functor fun;
|
||||
bool serious;
|
||||
Term tf, error_t, comment, culprit;
|
||||
Term tf, error_t, comment, culprit = TermNil;
|
||||
char *format;
|
||||
char s[MAXPATHLEN];
|
||||
|
||||
|
@ -527,6 +527,8 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||
|
||||
}
|
||||
if (type != ABORT_EVENT) {
|
||||
Term location;
|
||||
|
||||
/* This is used by some complex procedures to detect there was an error */
|
||||
if (IsAtomTerm(nt[0])) {
|
||||
strncpy(LOCAL_ErrorSay, (char *) RepAtom(AtomOfTerm(nt[0]))->StrOfAE,
|
||||
|
@ -538,14 +540,14 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||
MAX_ERROR_MSG_SIZE);
|
||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||
}
|
||||
nt[1] = TermNil;
|
||||
switch (type) {
|
||||
case RESOURCE_ERROR_HEAP:
|
||||
case RESOURCE_ERROR_STACK:
|
||||
case RESOURCE_ERROR_TRAIL:
|
||||
comment = MkAtomTerm(Yap_LookupAtom(tmpbuf));
|
||||
default:
|
||||
nt[1] = TermNil;
|
||||
if (comment != TermNil)
|
||||
default:
|
||||
if (comment != TermNil)
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("i")), comment),
|
||||
nt[1]);
|
||||
if (file && function) {
|
||||
|
@ -557,12 +559,12 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||
nt[1] =
|
||||
MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("c")), t3), nt[1]);
|
||||
}
|
||||
if ((culprit = Yap_pc_location(P, B, ENV)) != TermNil) {
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")), culprit),
|
||||
if ((location = Yap_pc_location(P, B, ENV)) != TermNil) {
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")), location),
|
||||
nt[1]);
|
||||
}
|
||||
if ((culprit = Yap_env_location(CP, B, ENV, 0)) != TermNil) {
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")), culprit),
|
||||
if ((location = Yap_env_location(CP, B, ENV, 0)) != TermNil) {
|
||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")), location),
|
||||
nt[1]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1924,6 +1924,8 @@ static Term build_bug_location(yamop *codeptr, PredEntry *pe) {
|
|||
} else
|
||||
p[4] = MkIntTerm(0);
|
||||
}
|
||||
} else {
|
||||
p[4] = MkIntTerm(0);
|
||||
}
|
||||
}
|
||||
} else if (pe->OpcodeOfPred == UNDEF_OPCODE) {
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
set (JPL_SOURCES
|
||||
src/c/jpl.c)
|
||||
|
||||
macro_optional_find_package(Java ON)
|
||||
find_package(Java )
|
||||
find_package(Java COMPONENTS Runtime Development)
|
||||
# find_package(Java COMPONENTS Development)
|
||||
# find_package(Java COMPONENTS Runtime)
|
||||
#find_package(JavaLibs)
|
||||
|
@ -12,7 +11,7 @@ macro_log_feature (Java_Development_FOUND "Java"
|
|||
"Use Java System"
|
||||
"http://www.java.org" FALSE)
|
||||
|
||||
if (Java_FOUND)
|
||||
if (Java_Development_FOUND)
|
||||
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
|
||||
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
|
||||
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
|
||||
|
@ -79,4 +78,4 @@ if (Java_FOUND)
|
|||
)
|
||||
endif(JNI_FOUND)
|
||||
|
||||
endif (Java_FOUND)
|
||||
endif (Java_Development_FOUND)
|
||||
|
|
Reference in New Issue