Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7503b90 authored by Emilian Peev's avatar Emilian Peev
Browse files

DngCreator: Avoid moving absent tag entries

Tags 'TAG_OPCODELIST2' and 'TAG_OPCODELIST3' could be
absent from the main image IFD. Check for their presence
first before moving in the thumbnail sub IFD.

Bug: 112526551
Test: Camera CTS
Change-Id: I7039a533777ca95524d4c7d586ca4b40739cd2e5
parent f989a15e
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1971,8 +1971,14 @@ static sp<TiffWriter> DngCreator_setup(JNIEnv* env, jobject thiz, uint32_t image
        tagsToMove.add(TAG_DEFAULTSCALE);
        tagsToMove.add(TAG_DEFAULTCROPORIGIN);
        tagsToMove.add(TAG_DEFAULTCROPSIZE);

        if (nullptr != writer->getEntry(TAG_OPCODELIST2, TIFF_IFD_0).get()) {
            tagsToMove.add(TAG_OPCODELIST2);
        }

        if (nullptr != writer->getEntry(TAG_OPCODELIST3, TIFF_IFD_0).get()) {
            tagsToMove.add(TAG_OPCODELIST3);
        }

        if (moveEntries(writer, TIFF_IFD_0, TIFF_IFD_SUB1, tagsToMove) != OK) {
            jniThrowException(env, "java/lang/IllegalStateException", "Failed to move entries");