From deb85d276e752b8e139b2057e5438d874b6de022 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Thu, 2 Jul 2020 09:20:44 +0200 Subject: [PATCH] cppcheck fix found with cppcheck 2.1 cc: @gtribello [multicolvar/InPlaneDistances.cpp:110] (warning) :nullPointerRedundantCheck: Either the condition 'bt' is redundant or there is possible null pointer dereference: bt. This looks like it might be a real bug! Should be checked and potentially backported if it's a bug fix. --- src/multicolvar/InPlaneDistances.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/multicolvar/InPlaneDistances.cpp b/src/multicolvar/InPlaneDistances.cpp index 423c72719..7a66dde63 100644 --- a/src/multicolvar/InPlaneDistances.cpp +++ b/src/multicolvar/InPlaneDistances.cpp @@ -107,7 +107,9 @@ InPlaneDistances::InPlaneDistances(const ActionOptions&ao): use_link=true; rcut=lt->getCutoff(); } else { vesselbase::Between* bt=dynamic_cast<vesselbase::Between*>( getPntrToVessel(0) ); - if( bt ) use_link=true; rcut=bt->getCutoff(); + if( bt ) { + use_link=true; rcut=bt->getCutoff(); + } } if( use_link ) { for(unsigned i=1; i<getNumberOfVessels(); ++i) { -- GitLab