Skip to content

Commit

Permalink
Remove null pointer checks when the pointer had already been used. Th…
Browse files Browse the repository at this point in the history
…e code would have caused a crash before the null pointer test if it'd ever occur, so presumably it doesn't.
  • Loading branch information
David Lowndes authored and David Lowndes committed Nov 17, 2024
1 parent d006567 commit 4721083
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/common/PatchDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<fs::path> parentFiles;
Expand Down
5 changes: 0 additions & 5 deletions src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/surge-xt/gui/overlays/LuaEditors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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");
}

Expand Down
18 changes: 6 additions & 12 deletions src/surge-xt/gui/overlays/MSEGEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 4721083

Please sign in to comment.