]> git.lizzy.rs Git - micro.git/commitdiff
Fix #2030: warn for invalid pane type
authorZachary Yedidia <zyedidia@gmail.com>
Fri, 19 Feb 2021 00:02:23 +0000 (19:02 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Fri, 19 Feb 2021 00:02:23 +0000 (19:02 -0500)
internal/action/bindings.go

index e0fe0b8a180564e91b212a830e7110bbf03ac2a1..c4a6964bc9467421733eae4c1e0e3f1f26c93eae 100644 (file)
@@ -3,6 +3,7 @@ package action
 import (
        "encoding/json"
        "errors"
+       "fmt"
        "io/ioutil"
        "os"
        "path/filepath"
@@ -61,7 +62,11 @@ func InitBindings() {
                case string:
                        BindKey(k, val, Binder["buffer"])
                case map[string]interface{}:
-                       bind := Binder[k]
+                       bind, ok := Binder[k]
+                       if !ok || bind == nil {
+                               screen.TermMessage(fmt.Sprintf("%s is not a valid pane type", k))
+                               continue
+                       }
                        for e, a := range val {
                                s, ok := a.(string)
                                if !ok {