#vulnerable code 
                                public String getErrorMessage() {
        String res = "";
        if (error != null) {
            res = error.getMessage();
            if(res==null || res.isEmpty()) {
                res = "Exception is: "+res.getClass().toString();
            }
        } else {
            res = "Unknown error";
            log.warn("Unexpected question for error message while no exception. Wazzup?");
        }
        return res;
    } 
                            #location 6 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public String getErrorMessage() {
        String res;
        if (error != null) {
            res = error.getMessage();
            if(res==null || res.isEmpty()) {
                res = "Exception is: "+error.getClass().toString();
            }
        } else {
            res = "Unknown error";
            log.warn("Unexpected question for error message while no exception. Wazzup?");
        }
        return res;
    }