Skip to content

Commit

Permalink
Fixed warning about undetermined behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
shoops committed Nov 30, 2023
1 parent 5769156 commit 4dbf920
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions copasi/core/CArray.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// Copyright (C) 2017 by Pedro Mendes, Virginia Tech Intellectual
// Copyright (C) 2019 - 2023 by Pedro Mendes, Rector and Visitors of the
// University of Virginia, University of Heidelberg, and University
// of Connecticut School of Medicine.
// All rights reserved.

// Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
// Properties, Inc., University of Heidelberg, and University of
// of Connecticut School of Medicine.
// All rights reserved.
Expand Down Expand Up @@ -39,6 +44,8 @@ void CArray::resize(const index_type & sizes)

CArray::data_type & CArray::operator[](const index_type & index)
{
static data_type Invalid;

assert(index.size() == mDim);

size_t tmpindex = 0;
Expand All @@ -49,7 +56,7 @@ CArray::data_type & CArray::operator[](const index_type & index)

for (; it != end; ++it, ++itSize, ++itFactor)
{
if (*it >= *itSize) return * (data_type *) NULL;
if (*it >= *itSize) return Invalid;

tmpindex += *itFactor **it;
}
Expand Down

0 comments on commit 4dbf920

Please sign in to comment.