diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-04-29 08:39:24 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-04-29 08:43:58 +0200 |
| commit | c32c4b7b41dcf0e170266f819b6a839fa4eac56d (patch) | |
| tree | 70032de60fc183a4050f3a9322983d3ff0f365a2 /vis.c | |
| parent | 0ef138085f885d4576a8e53d079e1f00f80799bf (diff) | |
| download | vis-c32c4b7b41dcf0e170266f819b6a839fa4eac56d.tar.gz vis-c32c4b7b41dcf0e170266f819b6a839fa4eac56d.tar.xz | |
vis: do not crash when processing :-commands and no window is active
This is needed to make the vis.event.start Lua callback useful,
setting global options should be possible even if no windows exist
yet.
The :set command options should probably be cleaned up further,
some of them apply only to the currently active window while others
have a global effect.
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -286,7 +286,7 @@ bool vis_window_new(Vis *vis, const char *filename) { } bool vis_window_closable(Win *win) { - if (!text_modified(win->file->text)) + if (!win || !text_modified(win->file->text)) return true; return win->file->refcount > 1; } @@ -321,6 +321,8 @@ void vis_window_swap(Win *a, Win *b) { } void vis_window_close(Win *win) { + if (!win) + return; Vis *vis = win->vis; if (!win->file->internal && vis->event && vis->event->win_close) vis->event->win_close(vis, win); |
