From 00314f956464b380be368dbe34494e37847a9af3 Mon Sep 17 00:00:00 2001 From: "lllucius@gmail.com" Date: Thu, 3 Oct 2013 14:50:58 +0000 Subject: [PATCH] Prevent NULL pointer dereferences due to the controls never being created when no projects are open on OSX. (The root window is active.) --- src/prefs/KeyConfigPrefs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/prefs/KeyConfigPrefs.cpp b/src/prefs/KeyConfigPrefs.cpp index c81071477..d84d7d27a 100644 --- a/src/prefs/KeyConfigPrefs.cpp +++ b/src/prefs/KeyConfigPrefs.cpp @@ -610,6 +610,15 @@ void KeyConfigPrefs::OnViewBy(wxCommandEvent & e) bool KeyConfigPrefs::Apply() { + // On the Mac, preferences may be changed without any active + // projects. This means that the CommandManager isn't availabe + // either. So we can't attempt to save preferences, otherwise + // NULL ptr dereferences will happen in ShuttleGui because the + // radio buttons are never created. (See Populate() above.) + if (!GetActiveProject()) { + return true; + } + ShuttleGui S(this, eIsSavingToPrefs); PopulateOrExchange(S);