Skip to content

Commit 6db5fa6

Browse files
authored
Merge pull request #145 from zhaozhiwen/fix/130-physlist-null-check
Null-check physics list before dereferencing it
2 parents 621f769 + b17e810 commit 6db5fa6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

gemc/gphysics/gphysics.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ GPhysics::GPhysics(const std::shared_ptr<GOptions>& gopts) :
5656

5757
physList = factory.GetReferencePhysList(g4physList);
5858

59+
if (!physList) { log->error(ERR_PHYSLISTERROR, "physics list <" + gphysList + "> could not be loaded."); }
60+
5961
// Register step limiters (module default add-on).
6062
// This is intentionally registered even when users select a standard reference list.
6163
physList->RegisterPhysics(new G4StepLimiterPhysics());
6264

63-
if (!physList) { log->error(ERR_PHYSLISTERROR, "physics list <" + gphysList + "> could not be loaded."); }
64-
6565
log->info(2, "G4PhysListFactory: <" + g4physList + "> loaded.");
6666
}
6767

0 commit comments

Comments
 (0)