From 26e94b774fd41df013c8eaa085bf54da9a3d48cb Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 28 Oct 2016 22:43:54 +0200 Subject: [PATCH] taproduct: fix incorrect assert() flagged by PVS-Studio For #192. * spot/ta/taproduct.cc: Check the output of down_cast, not its input. --- spot/ta/taproduct.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spot/ta/taproduct.cc b/spot/ta/taproduct.cc index a9ee2b7a3..859521d16 100644 --- a/spot/ta/taproduct.cc +++ b/spot/ta/taproduct.cc @@ -297,9 +297,8 @@ namespace spot ta_succ_iterator_product* ta_product::succ_iter(const state* s) const { - const state_ta_product* stp = down_cast (s); - assert(s); - + const state_ta_product* stp = down_cast(s); + assert(stp); return new ta_succ_iterator_product(stp, ta_.get(), kripke_.get()); } @@ -307,8 +306,8 @@ namespace spot ta_succ_iterator_product* ta_product::succ_iter(const spot::state* s, bdd changeset) const { - const state_ta_product* stp = down_cast (s); - assert(s); + const state_ta_product* stp = down_cast(s); + assert(stp); return new ta_succ_iterator_product_by_changeset(stp, ta_.get(), kripke_.get(), changeset);