From be7185faf7f52674028977dcf501c6039ff03aa5 Mon Sep 17 00:00:00 2001 From: Gilles Boccon-Gibod Date: Sat, 9 Sep 2017 10:36:28 -0700 Subject: [PATCH] fix for #182 --- Source/C++/Core/Ap4AtomFactory.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/C++/Core/Ap4AtomFactory.cpp b/Source/C++/Core/Ap4AtomFactory.cpp index 687aab551..f5bd06969 100644 --- a/Source/C++/Core/Ap4AtomFactory.cpp +++ b/Source/C++/Core/Ap4AtomFactory.cpp @@ -490,13 +490,17 @@ AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream, case AP4_ATOM_TYPE_HVCE: if (atom_is_large) return AP4_ERROR_INVALID_FORMAT; atom = AP4_HvccAtom::Create(size_32, stream); - atom->SetType(AP4_ATOM_TYPE_HVCE); + if (atom) { + atom->SetType(AP4_ATOM_TYPE_HVCE); + } break; case AP4_ATOM_TYPE_AVCE: if (atom_is_large) return AP4_ERROR_INVALID_FORMAT; atom = AP4_AvccAtom::Create(size_32, stream); - atom->SetType(AP4_ATOM_TYPE_AVCE); + if (atom) { + atom->SetType(AP4_ATOM_TYPE_AVCE); + } break; #if !defined(AP4_CONFIG_MINI_BUILD)