Skip to content

Commit

Permalink
Checking null problem components
Browse files Browse the repository at this point in the history
Signed-off-by: Ubuntu <ubuntu@ros-humble.lxd>
  • Loading branch information
Ubuntu committed May 26, 2022
1 parent 08e1429 commit bcc6cdf
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
7 changes: 6 additions & 1 deletion src/VALfiles/SimpleEval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ void InitialStateEvaluator::setInitialState()
{
initState.clear();
init0State.clear();


if (!current_analysis->the_problem->initial_state) {
return;
}


for(pc_list<simple_effect*>::const_iterator i =
current_analysis->the_problem->initial_state->add_effects.begin();
i != current_analysis->the_problem->initial_state->add_effects.end();++i)
Expand Down
2 changes: 1 addition & 1 deletion src/VALfiles/TimSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ class TIMAnalyser : public VAL::VisitController {
virtual void visit_problem(VAL::problem * p)
{
initially = true;
p->initial_state->visit(this);
if (p->initial_state) p->initial_state->visit(this);
initially = false;
finally = true;
if(p->the_goal) p->the_goal->visit(this);
Expand Down
4 changes: 2 additions & 2 deletions src/VALfiles/TypedAnalyser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ class TypePredSubstituter : public VisitController {
};
virtual void visit_problem(problem * p)
{
p->initial_state->visit(this);
if( p->initial_state) p->initial_state->visit(this);
if(p->the_goal) p->the_goal->visit(this);
if(p->constraints) p->constraints->visit(this);
};
Expand Down Expand Up @@ -1504,7 +1504,7 @@ class Analyser : public VisitController {
virtual void visit_problem(problem * p)
{
initially = true;
p->initial_state->visit(this);
if (p->initial_state) p->initial_state->visit(this);
initially = false;
finally = true;
if(p->the_goal) p->the_goal->visit(this);
Expand Down
6 changes: 3 additions & 3 deletions src/VALfiles/instantiation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ class InstQueueEntry {
/** Lexicographic comparison of <code>const_symbol</code>s, based on their names */
struct ConstSymbolLT {

bool operator()(const VAL::const_symbol* const a, const VAL::const_symbol* const b) {
bool operator()(const VAL::const_symbol* const a, const VAL::const_symbol* const b) const {
return (a->getName() < b->getName());
}
};
Expand Down Expand Up @@ -2163,9 +2163,9 @@ class Collector : public VisitController
visit_operator_(p);
};
virtual void visit_problem(VAL::problem * p) {
p->initial_state->visit(this);
if (p->initial_state) p->initial_state->visit(this);
inpres = false;
p->the_goal->visit(this);
if (p->the_goal) p->the_goal->visit(this);
if (p->constraints) p->constraints->visit(this);
};

Expand Down
2 changes: 1 addition & 1 deletion src/VALfiles/instantiation.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class instantiatedDrvUtils {

struct indexLT {

bool operator() (const index & a, const index & b) {
bool operator() (const index & a, const index & b) const {
VAL::pred_symbol * afirst = VAL::current_analysis->pred_tab.symbol_get(a.first->getName());
VAL::pred_symbol * bfirst = VAL::current_analysis->pred_tab.symbol_get(b.first->getName());
if (afirst < bfirst) return true;
Expand Down
2 changes: 1 addition & 1 deletion src/VALfiles/typecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ bool TypeChecker::typecheckProblem()
if (Verbose) *report << "Type-checking goal failed\n";
return false;
}
if (!typecheckEffects(thea->the_problem->initial_state)) {
if (thea->the_problem->initial_state && !typecheckEffects(thea->the_problem->initial_state)) {
if (Verbose) *report << "Type-checking initial state failed\n";
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions src/popf/RPGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ class GoalNumericCollector : public VisitController


virtual void visit_problem(VAL::problem * p) {

WhereAreWeNow = PARSE_GOAL;
inpres = false;

numToUse = numericGoals;
litToUse = literalGoals;
p->the_goal->visit(this);
if(p->the_goal) p->the_goal->visit(this);
WhereAreWeNow = PARSE_UNKNOWN;
if (p->constraints) {
WhereAreWeNow = PARSE_CONSTRAINTS;
Expand Down Expand Up @@ -1867,7 +1867,7 @@ class InitialStateCollector : public VisitController
virtual void visit_problem(VAL::problem * p) {
TimedPrecEffCollector::toBlame = 0;
WhereAreWeNow = PARSE_INITIAL;
p->initial_state->visit(this);
if (p->initial_state) p->initial_state->visit(this);
WhereAreWeNow = PARSE_UNKNOWN;
//inpres = false;
//p->the_goal->visit(this);
Expand Down
4 changes: 2 additions & 2 deletions src/popf/RPGBuilderNumerics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,15 +954,15 @@ struct InvData {

struct LTAVPointer {

bool operator()(const RPGBuilder::ArtificialVariable * const a, const RPGBuilder::ArtificialVariable * const b) {
bool operator()(const RPGBuilder::ArtificialVariable * const a, const RPGBuilder::ArtificialVariable * const b) const {
return ((*a) < (*b));
};

};

struct LTRNPPointer {

bool operator()(const RPGBuilder::RPGNumericPrecondition * const a, const RPGBuilder::RPGNumericPrecondition * const b) {
bool operator()(const RPGBuilder::RPGNumericPrecondition * const a, const RPGBuilder::RPGNumericPrecondition * const b) const {
return ((*a) < (*b));
};

Expand Down

0 comments on commit bcc6cdf

Please sign in to comment.