Cortex: Fix forming reference to null pointer

* Style fix only for the lines involved.

Signed-off-by: Jérôme Duval <[email protected]>
This commit is contained in:
Murai Takashi
2013-07-22 21:15:15 +02:00
committed by Jérôme Duval
parent 46cb3d3ea6
commit a385c68ad7
@@ -1299,14 +1299,22 @@ void MediaFormatIO::xmlImportChild(
MediaFormatIO* childAsFormat = dynamic_cast<MediaFormatIO*>(child); MediaFormatIO* childAsFormat = dynamic_cast<MediaFormatIO*>(child);
if(m_format.type == B_MEDIA_ENCODED_AUDIO) { if(m_format.type == B_MEDIA_ENCODED_AUDIO) {
if(!childAsFormat || childAsFormat->m_format.type != B_MEDIA_RAW_AUDIO) if (childAsFormat == NULL
|| childAsFormat->m_format.type != B_MEDIA_RAW_AUDIO) {
context.reportError("Expected a raw_audio_format."); context.reportError("Expected a raw_audio_format.");
m_format.u.encoded_audio.output = childAsFormat->m_format.u.raw_audio; } else {
m_format.u.encoded_audio.output =
childAsFormat->m_format.u.raw_audio;
}
} }
else if(m_format.type == B_MEDIA_ENCODED_VIDEO) { else if(m_format.type == B_MEDIA_ENCODED_VIDEO) {
if(!childAsFormat || childAsFormat->m_format.type != B_MEDIA_RAW_VIDEO) if (childAsFormat == NULL
|| childAsFormat->m_format.type != B_MEDIA_RAW_VIDEO) {
context.reportError("Expected a raw_video_format."); context.reportError("Expected a raw_video_format.");
m_format.u.encoded_video.output = childAsFormat->m_format.u.raw_video; } else {
m_format.u.encoded_video.output =
childAsFormat->m_format.u.raw_video;
}
} }
else { else {
// +++++ should this be an error? // +++++ should this be an error?