i am not a c++ programmer, but in the comments i see that GetLineCount starts from 0, so if there is 1 line it returns 0 and if there are 2 lines it returns 1 etc, so maybe in the chain until GetCount there is a line numbering problem.
I don't want to restart amule now, but i guess if i enter the same line twice it would not complain.