Skip to content

Commit 1f9dd99

Browse files
committed
Engine: Add missing stage null checks
1 parent 6a63262 commit 1f9dd99

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/engine/internal/engine.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,10 +1526,12 @@ std::shared_ptr<Variable> Engine::getVariable(const std::string &id, Target *tar
15261526
int index;
15271527

15281528
// Check stage
1529-
index = stage->findVariableById(id);
1529+
if (stage) {
1530+
index = stage->findVariableById(id);
15301531

1531-
if (index != -1)
1532-
return stage->variableAt(index);
1532+
if (index != -1)
1533+
return stage->variableAt(index);
1534+
}
15331535

15341536
// Check currently compiled target
15351537
if (target != stage) {
@@ -1562,10 +1564,12 @@ std::shared_ptr<List> Engine::getList(const std::string &id, Target *target)
15621564
int index;
15631565

15641566
// Check stage
1565-
index = stage->findListById(id);
1567+
if (stage) {
1568+
index = stage->findListById(id);
15661569

1567-
if (index != -1)
1568-
return stage->listAt(index);
1570+
if (index != -1)
1571+
return stage->listAt(index);
1572+
}
15691573

15701574
// Check currently compiled target
15711575
if (target != stage) {

0 commit comments

Comments
 (0)