Commit adc15181 authored by mattijs's avatar mattijs
Browse files

BUG: slicing of empty list

An empty list (m_) has no pointer so cannot be referenced. Instead we
now return a null pointer (which is no problem for UList)
parent cae4d383
......@@ -224,7 +224,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
)
{
label start = offsets_[i];
return UList<T>(&m_[start], offsets_[i+1] - start);
return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
}
......@@ -238,7 +238,7 @@ Foam::CompactListList<T, Container>::operator[]
label start = offsets_[i];
return UList<T>
(
const_cast<T*>(&m_[start]),
(m_.size() ? const_cast<T*>(&m_[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