Fix segfault if the server maliciously sends the wrong type of key