Help me about these codes

If you KNOW that you need to read 8 bytes, you must not do so until there are at least 8 bytes to read. Look at the documentation for the Serial.available() method. You will see that, despite your usage (which I abhor) that it is NOT a boolean function.