From 9a1c0dc2a6a4eb42f2cc47e1bf2568845c9985db Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Mon, 18 Oct 2021 06:28:10 -0700 Subject: Fix error management of `ErrorInformation` Fixes https://scan6.coverity.com/reports.htm#v37053/p11644/fileInstanceId=125548448&defectInstanceId=32441274&mergedDefectId=1453884. --- src/theory/arith/error_set.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/theory/arith/error_set.h') diff --git a/src/theory/arith/error_set.h b/src/theory/arith/error_set.h index 5585bf76f..36a75f12f 100644 --- a/src/theory/arith/error_set.h +++ b/src/theory/arith/error_set.h @@ -20,6 +20,7 @@ #pragma once +#include #include #include "options/arith_options.h" @@ -135,7 +136,7 @@ private: * Auxillary information for storing the difference between a variable and its bound. * Only set on signals. */ - DeltaRational* d_amount; + std::unique_ptr d_amount; /** */ uint32_t d_metric; @@ -173,7 +174,7 @@ public: inline void setInFocus(bool inFocus) { d_inFocus = inFocus; } const DeltaRational& getAmount() const { - Assert(d_amount != NULL); + Assert(d_amount != nullptr); return *d_amount; } @@ -201,9 +202,12 @@ public: << ", " << d_sgn << ", " << d_relaxed << ", " << d_inFocus; - if(d_amount == NULL){ - os << "NULL"; - }else{ + if (d_amount == nullptr) + { + os << "nullptr"; + } + else + { os << (*d_amount); } os << "}"; -- cgit v1.2.3