Do not use fWriter functions, when it has not been instantiated properly.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32122 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-08-05 10:07:43 +00:00
parent 3471097486
commit 99304ab063
+11 -6
View File
@@ -61,13 +61,15 @@ MediaWriter::~MediaWriter()
{ {
CALLED(); CALLED();
// free all stream cookies if (fWriter != NULL) {
// and chunk caches // free all stream cookies
StreamInfo* info; // and chunk caches
for (fStreamInfos.Rewind(); fStreamInfos.GetNext(&info);) StreamInfo* info;
fWriter->FreeCookie(info->cookie); for (fStreamInfos.Rewind(); fStreamInfos.GetNext(&info);)
fWriter->FreeCookie(info->cookie);
_plugin_manager.DestroyWriter(fWriter); _plugin_manager.DestroyWriter(fWriter);
}
// fTarget is owned by the BMediaFile // fTarget is owned by the BMediaFile
} }
@@ -99,6 +101,9 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
{ {
CALLED(); CALLED();
if (fWriter == NULL)
return B_NO_INIT;
// TODO: Here we should work out a way so that if there is a setup // TODO: Here we should work out a way so that if there is a setup
// failure we can try the next encoder. // failure we can try the next encoder.
Encoder* encoder; Encoder* encoder;