NewEx: fix panic if cfg.Painter is not given (#129)

This commit is contained in:
Saeed Rasooli 2017-10-02 14:46:29 +08:00 committed by chzyer
parent c6c3e8d906
commit aa9ed7db49
1 changed files with 3 additions and 0 deletions

View File

@ -161,6 +161,9 @@ func NewEx(cfg *Config) (*Instance, error) {
return nil, err return nil, err
} }
rl := t.Readline() rl := t.Readline()
if cfg.Painter == nil {
cfg.Painter = &defaultPainter{}
}
return &Instance{ return &Instance{
Config: cfg, Config: cfg,
Terminal: t, Terminal: t,