Ticket #9883: 0012-Fix-forming-reference-to-null-pointer.2.patch

File 0012-Fix-forming-reference-to-null-pointer.2.patch, 1.6 KB (added by mt, 11 years ago)

New patch

  • src/apps/cortex/Persistence/Wrappers/MediaFormatIO.cpp

    From da095b73152042c5b7370179c5f5700dc21cedf7 Mon Sep 17 00:00:00 2001
    From: Murai Takashi <tmurai01@gmail.com>
    Date: Mon, 22 Jul 2013 20:48:17 +0900
    Subject: [PATCH] Fix forming reference to null pointer
    
    ---
     .../cortex/Persistence/Wrappers/MediaFormatIO.cpp  |   16 ++++++++++++----
     1 file changed, 12 insertions(+), 4 deletions(-)
    
    diff --git a/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.cpp b/src/apps/cortex/Persistence/Wrappers/MediaFormatIO.cpp
    index 9d613db..ef2f825 100644
    a b void MediaFormatIO::xmlImportChild(  
    12991299
    13001300    MediaFormatIO* childAsFormat = dynamic_cast<MediaFormatIO*>(child);
    13011301    if(m_format.type == B_MEDIA_ENCODED_AUDIO) {
    1302         if(!childAsFormat || childAsFormat->m_format.type != B_MEDIA_RAW_AUDIO)
     1302        if(!childAsFormat ||
     1303            childAsFormat->m_format.type != B_MEDIA_RAW_AUDIO) {
    13031304            context.reportError("Expected a raw_audio_format.");
    1304         m_format.u.encoded_audio.output = childAsFormat->m_format.u.raw_audio;
     1305        } else {
     1306            m_format.u.encoded_audio.output =
     1307                childAsFormat->m_format.u.raw_audio;
     1308        }
    13051309    }
    13061310    else if(m_format.type == B_MEDIA_ENCODED_VIDEO) {
    1307         if(!childAsFormat || childAsFormat->m_format.type != B_MEDIA_RAW_VIDEO)
     1311        if(!childAsFormat ||
     1312            childAsFormat->m_format.type != B_MEDIA_RAW_VIDEO) {
    13081313            context.reportError("Expected a raw_video_format.");
    1309         m_format.u.encoded_video.output = childAsFormat->m_format.u.raw_video;
     1314        } else {
     1315            m_format.u.encoded_video.output =
     1316                childAsFormat->m_format.u.raw_video;
     1317        }
    13101318    }
    13111319    else {
    13121320        // +++++ should this be an error?