mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-04 22:20:20 +09:00
Don't call plugin if nil
This commit is contained in:
@@ -269,6 +269,8 @@ func main() {
|
|||||||
action.InfoBar.Display()
|
action.InfoBar.Display()
|
||||||
screen.Screen.Show()
|
screen.Screen.Show()
|
||||||
|
|
||||||
|
event = nil
|
||||||
|
|
||||||
// Check for new events
|
// Check for new events
|
||||||
select {
|
select {
|
||||||
case f := <-shell.Jobs:
|
case f := <-shell.Jobs:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"log"
|
||||||
|
|
||||||
lua "github.com/yuin/gopher-lua"
|
lua "github.com/yuin/gopher-lua"
|
||||||
ulua "github.com/zyedidia/micro/internal/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) {
|
func (p *Plugin) Call(fn string, args ...lua.LValue) (lua.LValue, error) {
|
||||||
plug := ulua.L.GetGlobal(p.Name)
|
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)
|
luafn := ulua.L.GetField(plug, fn)
|
||||||
if luafn == lua.LNil {
|
if luafn == lua.LNil {
|
||||||
return nil, ErrNoSuchFunction
|
return nil, ErrNoSuchFunction
|
||||||
|
|||||||
Reference in New Issue
Block a user