From 4721083680dd09081755fac757c820e492ffc096 Mon Sep 17 00:00:00 2001 From: David Lowndes Date: Sun, 17 Nov 2024 18:46:02 +0000 Subject: [PATCH] Remove null pointer checks when the pointer had already been used. The code would have caused a crash before the null pointer test if it'd ever occur, so presumably it doesn't. --- src/common/PatchDB.cpp | 1 - src/common/SurgeStorage.cpp | 5 ----- src/surge-xt/gui/overlays/LuaEditors.cpp | 4 ++-- src/surge-xt/gui/overlays/MSEGEditor.cpp | 18 ++++++------------ 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/common/PatchDB.cpp b/src/common/PatchDB.cpp index 6ca8ff82af7..1e793b99160 100644 --- a/src/common/PatchDB.cpp +++ b/src/common/PatchDB.cpp @@ -839,7 +839,6 @@ CREATE TABLE IF NOT EXISTS Favorites ( std::ostringstream searchName; searchName << p.name << " "; - if (storage) { auto pTmp = p.path.parent_path(); std::vector parentFiles; diff --git a/src/common/SurgeStorage.cpp b/src/common/SurgeStorage.cpp index 5a04f9ba92c..890e5c472c8 100644 --- a/src/common/SurgeStorage.cpp +++ b/src/common/SurgeStorage.cpp @@ -1332,11 +1332,6 @@ void SurgeStorage::load_wt(int id, Wavetable *wt, OscillatorStorage *osc) return; } - if (!wt) - { - return; - } - load_wt(path_to_string(wt_list[id].path), wt, osc); if (osc) diff --git a/src/surge-xt/gui/overlays/LuaEditors.cpp b/src/surge-xt/gui/overlays/LuaEditors.cpp index 1b04ba32788..de3dc732bac 100644 --- a/src/surge-xt/gui/overlays/LuaEditors.cpp +++ b/src/surge-xt/gui/overlays/LuaEditors.cpp @@ -292,7 +292,7 @@ struct ExpandingFormulaDebugger : public juce::Component, public Surge::GUI::Ski stepLfoDebugger(); - if (editor && editor->editor) + if (editor->editor) editor->editor->enqueueAccessibleAnnouncement("Reset Debugger"); } @@ -339,7 +339,7 @@ struct ExpandingFormulaDebugger : public juce::Component, public Surge::GUI::Ski debugTable->repaint(); } - if (editor && editor->editor) + if (editor->editor) editor->editor->enqueueAccessibleAnnouncement("Stepped Debugger"); } diff --git a/src/surge-xt/gui/overlays/MSEGEditor.cpp b/src/surge-xt/gui/overlays/MSEGEditor.cpp index 55eb2555c30..10581fb0a6a 100644 --- a/src/surge-xt/gui/overlays/MSEGEditor.cpp +++ b/src/surge-xt/gui/overlays/MSEGEditor.cpp @@ -2943,14 +2943,11 @@ void MSEGControlRegion::valueChanged(Surge::GUI::IComponentTagValue *p) Surge::MSEG::modifyEditMode(this->ms, editMode); // zoom to fit - if (canvas) - { - canvas->ms->axisStart = 0.f; - canvas->ms->axisWidth = editMode ? 1.f : ms->envelopeModeDuration; + canvas->ms->axisStart = 0.f; + canvas->ms->axisWidth = editMode ? 1.f : ms->envelopeModeDuration; - canvas->modelChanged(0, false); - canvas->repaint(); - } + canvas->modelChanged(0, false); + canvas->repaint(); repaint(); break; @@ -2961,11 +2958,8 @@ void MSEGControlRegion::valueChanged(Surge::GUI::IComponentTagValue *p) canvas->pushToUndo(); int m = floor((val * 2) + 0.1) + 1; ms->loopMode = (MSEGStorage::LoopMode)m; - if (canvas) - { - canvas->modelChanged(); - canvas->repaint(); - } + canvas->modelChanged(); + canvas->repaint(); repaint(); break; }