From d0a7745d416e45db1fe0e09cb4a4110b3b974236 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sun, 7 Jan 2007 03:19:48 +0000 Subject: [PATCH] Fixed uninited variable causing exception Originally committed to SVN as r730. --- aegisub/audio_player_dsound.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aegisub/audio_player_dsound.cpp b/aegisub/audio_player_dsound.cpp index 5454e98ae..119e4ec30 100644 --- a/aegisub/audio_player_dsound.cpp +++ b/aegisub/audio_player_dsound.cpp @@ -63,6 +63,7 @@ DirectSoundPlayer::DirectSoundPlayer() { directSound = NULL; thread = NULL; threadRunning = false; + notificationEvent = NULL; } @@ -222,7 +223,8 @@ void DirectSoundPlayer::Play(__int64 start,__int64 count) { buffer->Stop(); // Create notification event - CloseHandle(notificationEvent); + if (notificationEvent) + CloseHandle(notificationEvent); notificationEvent = CreateEvent(NULL,false,false,NULL); // Create notification interface @@ -293,7 +295,8 @@ void DirectSoundPlayer::Stop(bool timerToo) { offset = 0; // Close event handle - CloseHandle(notificationEvent); + if (notificationEvent) + CloseHandle(notificationEvent); // Stop timer if (timerToo && displayTimer) {