Shared/Packets: Handle crash by throwing an exception instead

Throw a ByteBufferException when trying to access the first element of an empty ByteBuffer class