commit 1e7fc5bc688bd7cde48e137cb81f094142630138
parent 964245cca45ac9c103eef7293132707b44a72c1a
Author: Gaute Hope <eg@gaute.vetsj.com>
Date: Tue, 18 Nov 2014 10:03:31 +0100
buffer is nil sometimes, just ignore
apparently the buffer is gone before the operation is finished
sometimes, it seems that the standard practice throughout the codebase
is to just check if the buffer is not nil (evaluates to true).
Diffstat:
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/History.txt b/History.txt
@@ -1,9 +1,11 @@
==
-* You can now unsubscribe from mailinglists using an url, if you have
- a goto-hook setup (Timon Vonk).
+* You can now unsubscribe from mailinglists using an url, if you have a
+ goto-hook setup (Timon Vonk).
* Forward attribution can be customized using the forward-attribution
hook (Ruthard Baudach)
+* Do a few more checks for buffer not nil in the hope to fix a few
+ random crashes
== 0.20.0 / 2014-10-06
diff --git a/lib/sup/modes/line_cursor_mode.rb b/lib/sup/modes/line_cursor_mode.rb
@@ -65,7 +65,7 @@ protected
def set_cursor_pos p
return if @curpos == p
@curpos = p.clamp @cursor_top, lines
- buffer.mark_dirty
+ buffer.mark_dirty if buffer # not sure why the buffer is gone
set_status
end
diff --git a/lib/sup/modes/thread_index_mode.rb b/lib/sup/modes/thread_index_mode.rb
@@ -1026,7 +1026,7 @@ private
end
def from_width
- [(buffer.content_width.to_f * 0.2).to_i, MIN_FROM_WIDTH].max
+ [(buffer.content_width.to_f * 0.2).to_i, MIN_FROM_WIDTH].max if buffer else MIN_FROM_WIDTH # not sure why the buffer is gone
end
def initialize_threads