From 6b5597218330b3702cf2b86b2163d5fe769b76a2 Mon Sep 17 00:00:00 2001 From: Vincent Glize Date: Sat, 3 Mar 2018 13:18:28 +0100 Subject: [PATCH] Fix error when keyblock is nil (#394) --- src/github.com/matrix-org/dendrite/common/config/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/github.com/matrix-org/dendrite/common/config/config.go b/src/github.com/matrix-org/dendrite/common/config/config.go index 1e2374a84..ad8842071 100644 --- a/src/github.com/matrix-org/dendrite/common/config/config.go +++ b/src/github.com/matrix-org/dendrite/common/config/config.go @@ -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 == "" {