mirror of
https://github.com/Hopiu/micro.git
synced 2026-05-04 21:04:42 +00:00
Don't call plugin if nil
This commit is contained in:
parent
953f5a0eff
commit
03228762d4
2 changed files with 7 additions and 0 deletions
|
|
@ -269,6 +269,8 @@ func main() {
|
|||
action.InfoBar.Display()
|
||||
screen.Screen.Show()
|
||||
|
||||
event = nil
|
||||
|
||||
// Check for new events
|
||||
select {
|
||||
case f := <-shell.Jobs:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package config
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
ulua "github.com/zyedidia/micro/internal/lua"
|
||||
|
|
@ -103,6 +104,10 @@ func (p *Plugin) Load() error {
|
|||
|
||||
func (p *Plugin) Call(fn string, args ...lua.LValue) (lua.LValue, error) {
|
||||
plug := ulua.L.GetGlobal(p.Name)
|
||||
if plug == lua.LNil {
|
||||
log.Println("Plugin does not exist:", p.Name, "at", p.DirName, ":", p)
|
||||
return nil, nil
|
||||
}
|
||||
luafn := ulua.L.GetField(plug, fn)
|
||||
if luafn == lua.LNil {
|
||||
return nil, ErrNoSuchFunction
|
||||
|
|
|
|||
Loading…
Reference in a new issue