Null pointer exception with mp4 files calling getFirst(FieldKey.ITUNES_GROUPING)

Issue #221 resolved
Former user created an issue

suggestion:

Mp4Tag.java:

...

    public List<TagField> getFields(FieldKey genericKey) throws KeyNotFoundException
    {
        if (genericKey == null)
        {
            throw new KeyNotFoundException();
        }
        Mp4FieldKey mp4FieldKey = tagFieldToMp4Field.get(genericKey);
        /****** INSERTED *******/
        if (mp4FieldKey == null)
        {
            throw new KeyNotFoundException();
        }
        /****** END ******/
        List<TagField> list = getFields(mp4FieldKey.getFieldName());

and

AbstractID3v2Tag.java:

   public List<TagField> getFields(FieldKey genericKey) throws KeyNotFoundException
    {
        if (genericKey == null)
        {
            throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
        }
        FrameAndSubId formatKey = getFrameAndSubIdFromGenericKey(genericKey);
        /****** INSERTED *******/
        if (formatKey == null)
        {
            throw new KeyNotFoundException();
        }
        /****** END ******/

Comments (3)

  1. IJabz repo owner

    Ah, so the support for iTunes classical fields has come back to bite me. Since ITUNES_GROUPING was added for ID3 because if Classical then iTunes store grouping in GRP1 instead of the standard TIT1, no such problem for Mp4 and other formats so hence FieldKey.ITUNES_GROUPING is only mapped to the ID3 format, probably need to make simailr fix for Asf and VorbisComment

  2. Log in to comment