Commit 98b79fad authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: avoid potential deadlock when resizing from zero-sized list

- not yet triggered by any code, but avoid anyhow
parent c2123452
......@@ -163,6 +163,8 @@ inline T& Foam::List<T>::newElmt(const label i)
if (i >= n)
{
if (!n) n = 1; // Avoid dead-lock when starting from zero-sized
do
{
n *= 2;
......
......@@ -114,8 +114,10 @@ void Foam::ITstream::reserveCapacity
label n = tokenList::size();
if (nElem >= n)
if (nElem > n)
{
if (!n) n = 1; // Avoid dead-lock when starting from zero-sized
do
{
n *= 2;
......
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