#vulnerable code 
                                private MagicMatch readMatch(Element element) throws MimeTypeException {

        String offset = null;
        String value = null;
        String mask = null;
        String type = null;

        NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            Attr attr = (Attr) attrs.item(i);
            if (attr.getName().equals(MATCH_OFFSET_ATTR)) {
                offset = attr.getValue();
            } else if (attr.getName().equals(MATCH_TYPE_ATTR)) {
                type = attr.getValue();
            } else if (attr.getName().equals(MATCH_VALUE_ATTR)) {
                value = attr.getValue();
            } else if (attr.getName().equals(MATCH_MASK_ATTR)) {
                mask = attr.getValue();
            }
        }
        // Parse OffSet
        String[] offsets = offset.split(":");
        int offStart = 0;
        int offEnd = 0;
        try {
            offStart = Integer.parseInt(offsets[0]);
        } catch (Exception e) {
            // WARN log + avoid loading
        }
        try {
            offEnd = Integer.parseInt(offsets[1]);
        } catch (Exception e) {
            // WARN log
        }
        offEnd = Math.max(offStart, offEnd);

        return new MagicMatch(offStart, offEnd, type, mask, value);
    } 
                            #location 22 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                private MagicMatch readMatch(Element element) throws MimeTypeException {

        String offset = null;
        String value = null;
        String mask = null;
        String type = null;

        NamedNodeMap attrs = element.getAttributes();
        for (int i = 0; i < attrs.getLength(); i++) {
            Attr attr = (Attr) attrs.item(i);
            if (attr.getName().equals(MATCH_OFFSET_ATTR)) {
                offset = attr.getValue();
            } else if (attr.getName().equals(MATCH_TYPE_ATTR)) {
                type = attr.getValue();
            } else if (attr.getName().equals(MATCH_VALUE_ATTR)) {
                value = attr.getValue();
            } else if (attr.getName().equals(MATCH_MASK_ATTR)) {
                mask = attr.getValue();
            }
        }

        // Parse OffSet
        int offStart = 0;
        int offEnd = 0;
        if (offset != null) {
            int colon = offset.indexOf(':');
            if (colon == -1) {
                offStart = Integer.parseInt(offset);
                offEnd = offStart;
            } else {
                offStart = Integer.parseInt(offset.substring(0, colon));
                offEnd = Integer.parseInt(offset.substring(colon + 1));
                offEnd = Math.max(offStart, offEnd);
            }
        }

        return new MagicMatch(offStart, offEnd, type, mask, value);
    }