Fix error when keyblock is nil

This commit is contained in:
Vincent Glize 2018-02-12 22:17:47 +01:00
parent 08274bab5a
commit 08d9725d5d
No known key found for this signature in database
GPG key ID: DD3B1180ECD4C41D

View file

@ -525,6 +525,9 @@ func readKeyPEM(path string, data []byte) (gomatrixserverlib.KeyID, ed25519.Priv
if data == nil {
return "", nil, fmt.Errorf("no matrix private key PEM data in %q", path)
}
if keyBlock == nil {
return "", nil, fmt.Errorf("keyBlock is nil %q", path)
}
if keyBlock.Type == "MATRIX PRIVATE KEY" {
keyID := keyBlock.Headers["Key-ID"]
if keyID == "" {