From fec305fe781d2108afa9d86fdba13d4dcfcae866 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 4 Jul 2006 21:59:30 +0000 Subject: [PATCH] Fixed two crash bugs related to audio. Originally committed to SVN as r463. --- core/audio_display.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/audio_display.cpp b/core/audio_display.cpp index ba8568e62..0117d3469 100644 --- a/core/audio_display.cpp +++ b/core/audio_display.cpp @@ -133,6 +133,9 @@ void AudioDisplay::Reset() { //////////////// // Update image void AudioDisplay::UpdateImage(bool weak) { + // Loaded? + if (!loaded || !provider) return; + // Prepare bitmap int displayH = h+20; if (origImage) { @@ -776,6 +779,7 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) { // Update samples void AudioDisplay::UpdateSamples() { // Set samples + if (!provider) return; __int64 totalSamples = provider->GetNumSamples(); int total = totalSamples / w; int max = 5760000 / w; // 2 minutes at 48 kHz maximum @@ -817,6 +821,7 @@ void AudioDisplay::SetFile(wxString file, VideoProvider *vprovider) { Reset(); loaded = false; + temporary = false; } // Load @@ -868,6 +873,7 @@ void AudioDisplay::SetFromVideo() { //////////////////// // Update scrollbar void AudioDisplay::UpdateScrollbar() { + if (!provider) return; int page = w/12; int len = provider->GetNumSamples() / samples / 12; Position = PositionSample / samples; @@ -1054,6 +1060,9 @@ void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) { ////////////////// // Commit changes void AudioDisplay::CommitChanges () { + // Loaded? + if (!loaded) return; + if (!Options.AsBool(_T("Audio SSA Mode")) && !box->audioKaraoke->splitting) { // Check if there's any need to commit if (!NeedCommit) return;