"System.ArgumentOutOfRangeException: Length cannot be less than zero"
<p>This code reads from log files, and if any of the lines contain -r and a user.Handle, it will replace the -r with an ^ cut off everything before ^, cut off everything after the :, and then save the remaining text. I'm getting the error specified in the title ONLY SOMETIMES</p>

<pre><code>if (line.Contains(user.Handle) &amp;&amp; line.Contains("-r"))
{
    string a = line.Replace("-r", "^");
    string b = a.Substring(a.IndexOf('^') + 1);
    string c = b.Substring(0, b.IndexOf(':'));
    if (!isDuplicate(c))
    {
        listViewEx1.Items.Add(new ListViewItem(user.Handle)
        {
            SubItems = { c }
        });
        dupCheck.Add(c);
        logcount++;
    }
</code></pre>