From 2d4df7f2fca502bba242fd7d275383904bd5de0b Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 23 Sep 2008 08:33:09 +0000 Subject: [PATCH] CID 80. err was checked twice for the same value. Also add more error checks git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27701 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/game/GameSoundBuffer.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/kits/game/GameSoundBuffer.cpp b/src/kits/game/GameSoundBuffer.cpp index bcd3ab6246..a913ef2492 100644 --- a/src/kits/game/GameSoundBuffer.cpp +++ b/src/kits/game/GameSoundBuffer.cpp @@ -356,25 +356,29 @@ status_t GameSoundBuffer::Connect(media_node * consumer) { BMediaRoster* r = BMediaRoster::Roster(); - status_t err; + status_t err = r->RegisterNode(fNode); - err = r->RegisterNode(fNode); if (err != B_OK) return err; // make sure the Media Roster knows that we're using the node - r->GetNodeFor(fNode->Node().node, &fConnection->producer); + err = r->GetNodeFor(fNode->Node().node, &fConnection->producer); + if (err != B_OK) + return err; + // connect to the mixer fConnection->consumer = *consumer; - if (err != B_OK) - return err; - + // set the producer's time source to be the "default" time source, which // the Mixer uses too. - r->GetTimeSource(&fConnection->timeSource); - r->SetTimeSourceFor(fConnection->producer.node, fConnection->timeSource.node); + err = r->GetTimeSource(&fConnection->timeSource); + if (err != B_OK) + return err; + err = r->SetTimeSourceFor(fConnection->producer.node, fConnection->timeSource.node); + if (err != B_OK) + return err; // got the nodes; now we find the endpoints of the connection media_input mixerInput; media_output soundOutput;