[LyX/master] Fix a null pointer dereference spotted by coverity

Juergen Spitzmueller spitz at lyx.org
Sat Jan 30 12:44:50 UTC 2021


commit be14b737878a20318422a1f195c1936f889e4d6f
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sat Jan 30 13:46:47 2021 +0100

    Fix a null pointer dereference spotted by coverity
---
 src/Buffer.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index c46dab7..8414efa 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2944,7 +2944,9 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
 				undo().recordUndoBufferParams(CursorData());
 				branch_list.add(branch_name);
 				branch = branch_list.find(branch_name);
-				branch->setColors("background", "background");
+				if (branch)
+					// needed to update the color table for dark mode
+					branch->setColors("background", "background");
 				dr.setError(false);
 				dr.screenUpdate(Update::Force);
 			}


More information about the lyx-cvs mailing list