From 532d9b230b5ef16500477764300f35485f33eeb4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 18 Nov 2017 16:30:27 +0100 Subject: [PATCH] fix coverity issue --- src/App/Expression.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp index 3100afdf4b..c4654c95b7 100644 --- a/src/App/Expression.cpp +++ b/src/App/Expression.cpp @@ -1035,9 +1035,14 @@ Expression * FunctionExpression::eval() const } case HYPOT: case CATH: + if (v2 == 0) + throw ExpressionError("Invalid second argument."); if (v1->getUnit() != v2->getUnit()) throw ExpressionError("Units must be equal"); + if (args.size() > 2) { + if (v3 == 0) + throw ExpressionError("Invalid second argument."); if (v2->getUnit() != v3->getUnit()) throw ExpressionError("Units must be equal"); }