mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-21 16:37:12 +01:00
Mac: don't crash in Preferences when there is no project window...
... and you press Preview in Spectrogram preferences. And complete null checks on GetActiveProject calls in src/prefs. And in fact, don't even show the useless Preview button when there is no project.
This commit is contained in:
@@ -429,9 +429,12 @@ void SpectrumPrefs::Rollback()
|
||||
}
|
||||
|
||||
if (isOpenPage) {
|
||||
auto &tp = TrackPanel::Get ( *::GetActiveProject() );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
auto pProject = ::GetActiveProject();
|
||||
if ( pProject ) {
|
||||
auto &tp = TrackPanel::Get ( *pProject );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,9 +480,12 @@ void SpectrumPrefs::Preview()
|
||||
}
|
||||
|
||||
if (isOpenPage) {
|
||||
auto &tp = TrackPanel::Get( *::GetActiveProject() );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
auto pProject = ::GetActiveProject();
|
||||
if ( pProject ) {
|
||||
auto &tp = TrackPanel::Get( *pProject );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +506,7 @@ bool SpectrumPrefs::Commit()
|
||||
|
||||
bool SpectrumPrefs::ShowsPreviewButton()
|
||||
{
|
||||
return true;
|
||||
return GetActiveProject() != nullptr;
|
||||
}
|
||||
|
||||
void SpectrumPrefs::OnControl(wxCommandEvent&)
|
||||
|
||||
@@ -191,9 +191,12 @@ bool WaveformPrefs::Commit()
|
||||
}
|
||||
|
||||
if (isOpenPage) {
|
||||
auto &tp = TrackPanel::Get( *::GetActiveProject() );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
auto pProject = ::GetActiveProject();
|
||||
if ( pProject ) {
|
||||
auto &tp = TrackPanel::Get( *pProject );
|
||||
tp.UpdateVRulers();
|
||||
tp.Refresh(false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user