From 1560303d837127e024f3a474e8d0a3512c8e616a Mon Sep 17 00:00:00 2001 From: Maxim Koltsov Date: Fri, 27 Feb 2015 14:09:53 +0300 Subject: [PATCH] Fix writeHelp() to support functors This fixes a bug when running with '-h' option results in a segmentation fault. --- src/gromacs/trajectoryanalysis/cmdlinerunner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp b/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp index 46d6255a5d..25e1181494 100644 --- a/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp +++ b/src/gromacs/trajectoryanalysis/cmdlinerunner.cpp @@ -346,7 +346,7 @@ int TrajectoryAnalysisCommandLineRunner::Impl::RunnerCommandLineModule::run( void TrajectoryAnalysisCommandLineRunner::Impl::RunnerCommandLineModule::writeHelp( const CommandLineHelpContext &context) const { - TrajectoryAnalysisModulePointer module(factory_()); + TrajectoryAnalysisModulePointer module(hasFunction_? factory_() : (*functor_)()); TrajectoryAnalysisCommandLineRunner runner(module.get()); runner.writeHelp(context); } -- 2.22.0