I'd normally suspect a dangling else as the cause of this, but #8 (the only place the entire code has been posted) doesn't show anything obvious.
The reason is that variable sLanguageLine isn't initialized at the beginning.
I will try this code later, but thank you in advance.
I will post again whether I had success or not.