Skip to content

Commit 290184c

Browse files
committed
EventDispenser fix
1 parent 0d7a54d commit 290184c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

gemc/eventDispenser/eventDispenser.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ EventDispenser::EventDispenser(const std::shared_ptr<GOptions>&
3131
neventsToProcess = gopt->getScalarInt("n");
3232

3333
// Detect offscreen mode once at construction so processEvents() needs no vis headers.
34-
auto driverNode = gopt->getOptionMapInNode("g4view", "driver");
35-
if (!driverNode.IsNull() && driverNode.IsDefined()) {
36-
offscreen_screenshots = (driverNode.as<std::string>() == "TOOLSSG_OFFSCREEN");
34+
// g4view is only defined when g4display options are included (e.g. in the full gemc app).
35+
if (gopt->doesOptionExist("g4view")) {
36+
auto driverNode = gopt->getOptionMapInNode("g4view", "driver");
37+
if (!driverNode.IsNull() && driverNode.IsDefined()) {
38+
offscreen_screenshots = (driverNode.as<std::string>() == "TOOLSSG_OFFSCREEN");
39+
}
3740
}
3841

3942
// If there are no events to process, keep the object in an initialized-but-idle state.

0 commit comments

Comments
 (0)