You need to test Serial.available() before each Serial.read() to be sure at least one (new) char has been received. Otherwise you have to take into account that Serial.read() might return -1, i.e. no (new) character was received at the time Serial.read() was called.