-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
(from David Hind)
I know it's an old project but I thought you might be interested in a bug I found in P4.Net.
It was crashing in P4Record.cs in this function:
private void processArray(string baseName)
{
if (!_ArrayFields.ContainsKey(baseName))
{
List<string> list = new List<string>();
for (int i = 0; ; i++)
{
string key = string.Format("{0}{1}", baseName, i);
// fileSize will get us here too. If a file is deleted and re-added,
// the a filelog command will skip some numbers on the fileSize
if (!_allFields.ContainsKey(key))
{
// peek ahead one file to see if one happend to be skipped
string key2 = string.Format("{0}{1}", baseName, i + 1);
if (_allFields.ContainsKey(key2))
{
list.Add("");
}
else
{
break;
}
}
list.Add(_allFields[key]);
}
_ArrayFields.Add(baseName, list.ToArray());
}
}_allFields was missing a Key (it was filesize that didn't exist since the file was being deleted). It tries to add it anyway in list.add(_allFields[key]).
This is the fixed funciton:
private void processArray(string baseName)
{
if (!_ArrayFields.ContainsKey(baseName))
{
List<string> list = new List<string>();
for (int i = 0; ; i++)
{
string key = string.Format("{0}{1}", baseName, i);
// fileSize will get us here too. If a file is deleted and re-added,
// the a filelog command will skip some numbers on the fileSize
if (!_allFields.ContainsKey(key))
{
// peek ahead one file to see if one happend to be skipped
string key2 = string.Format("{0}{1}", baseName, i + 1);
if (_allFields.ContainsKey(key2))
{
list.Add("");
}
else
{
break;
}
}
else
}
list.Add(_allFields[key]);
}
}
_ArrayFields.Add(baseName, list.ToArray());
}
}I only saw this bug recently, which makes me suspicious (that something else changed). I know we did a perforce upgrade recently, so it might be related.
Cheers,
David.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels