Skip to content

Commit 7cec58c

Browse files
committed
Aggressively check for buffer presence, as the use may have closed it
while this function was running.
1 parent 7b3cd7c commit 7cec58c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua/neogit/buffers/status/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,18 @@ function M:redraw(cursor, view)
293293
logger.debug("[STATUS] Rendering UI")
294294
self.buffer.ui:render(unpack(ui.Status(git.repo.state, self.config)))
295295

296-
if self.fold_state then
296+
if self.fold_state and self.buffer then
297297
logger.debug("[STATUS] Restoring fold state")
298298
self.buffer.ui:set_fold_state(self.fold_state)
299299
self.fold_state = nil
300300
end
301301

302-
if self.cursor_state and self.view_state then
302+
if self.cursor_state and self.view_state and self.buffer then
303303
logger.debug("[STATUS] Restoring cursor and view state")
304304
self.buffer:restore_view(self.view_state, self.cursor_state)
305305
self.view_state = nil
306306
self.cursor_state = nil
307-
elseif cursor and view then
307+
elseif cursor and view and self.buffer then
308308
self.buffer:restore_view(view, self.buffer.ui:resolve_cursor_location(cursor))
309309
end
310310
end

0 commit comments

Comments
 (0)