From 115fa590dc7d4f37714d514309643896a5041ab4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 21 Oct 2015 10:56:24 +0200 Subject: More plausible fix ...for 7c465e7f9e8b5c34a4926fb0de84de70aee8f37d "coverity#1326260 Explicit null dereferenced" Change-Id: I3b7fb8195c29b7e447fbe31f823cd00d7a820e95 --- nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nlpsolver/src/com') diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java index 16bb7e861605..e1386a6e52c3 100644 --- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java +++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java @@ -246,8 +246,10 @@ public abstract class BaseNLPSolver extends WeakBase RowInfo currentRow = null; int lastSheet = -1, lastRow = -1; for (int i = 0; i < m_variableCount; i++) { - if (lastSheet == m_variables[i].Sheet && lastRow == m_variables[i].Row && - currentRow != null && currentRow.EndCol == m_variables[i].Column - 1) + boolean match = lastSheet == m_variables[i].Sheet && + lastRow == m_variables[i].Row; + assert !match || currentRow != null; + if (match && currentRow.EndCol == m_variables[i].Column - 1) currentRow.EndCol++; else { currentRow = new RowInfo(m_variables[i].Sheet, m_variables[i].Row); -- cgit