Commit 95148e57 authored by andy's avatar andy
Browse files

BUG: CompactListList - corrected access via [] operator for zero-sized lists

parent 66f03819
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -223,7 +223,11 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
)
{
label start = offsets_[i];
return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
return UList<T>
(
(m_.size() ? m_.begin() + start : NULL),
offsets_[i+1] - start
);
}
......@@ -237,7 +241,7 @@ Foam::CompactListList<T, Container>::operator[]
label start = offsets_[i];
return UList<T>
(
(m_.size() ? const_cast<T*>(&m_[start]) : NULL),
(m_.size() ? const_cast<T*>(m_.begin() + start) : NULL),
offsets_[i+1] - start
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment