From 08d9725d5d7c648c78bbb9905e42fac598a5ec81 Mon Sep 17 00:00:00 2001 From: Vincent Glize Date: Mon, 12 Feb 2018 22:17:47 +0100 Subject: [PATCH] Fix error when keyblock is nil --- 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 == "" {