#vulnerable code 
                                public static int offsetof(Class<? extends Pointer> type, String member) {
        // Should we synchronize that?
        return memberOffsets.get(type).get(member);
    } 
                            #location 3 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public static int offsetof(Class<? extends Pointer> type, String member) {
        // Should we synchronize that?
        HashMap<String,Integer> offsets = memberOffsets.get(type);
        while (offsets == null && type.getSuperclass() != null) {
            type = type.getSuperclass().asSubclass(Pointer.class);
            offsets = memberOffsets.get(type);
        }
        return offsets.get(member);
    }