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
This commit is contained in:
Stefano Ceccherini
2008-09-23 08:33:09 +00:00
parent b0acb3febf
commit 2d4df7f2fc
+11 -7
View File
@@ -356,25 +356,29 @@ status_t
GameSoundBuffer::Connect(media_node * consumer) GameSoundBuffer::Connect(media_node * consumer)
{ {
BMediaRoster* r = BMediaRoster::Roster(); BMediaRoster* r = BMediaRoster::Roster();
status_t err; status_t err = r->RegisterNode(fNode);
err = r->RegisterNode(fNode);
if (err != B_OK) if (err != B_OK)
return err; return err;
// make sure the Media Roster knows that we're using the node // 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);
// connect to the mixer
fConnection->consumer = *consumer;
if (err != B_OK) if (err != B_OK)
return err; return err;
// connect to the mixer
fConnection->consumer = *consumer;
// set the producer's time source to be the "default" time source, which // set the producer's time source to be the "default" time source, which
// the Mixer uses too. // the Mixer uses too.
r->GetTimeSource(&fConnection->timeSource); err = r->GetTimeSource(&fConnection->timeSource);
r->SetTimeSourceFor(fConnection->producer.node, fConnection->timeSource.node); 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 // got the nodes; now we find the endpoints of the connection
media_input mixerInput; media_input mixerInput;
media_output soundOutput; media_output soundOutput;