Skip to content
Snippets Groups Projects
Commit 98584179 authored by Administrator's avatar Administrator
Browse files

Update RequestService.java reject function to fix potential nullpointer...

Update RequestService.java reject function to fix potential nullpointer exception if request doesn't have assistant yet.
parent 13b87799
Branches
Tags
No related merge requests found
......@@ -199,7 +199,7 @@ public class RequestService {
* @param request
*/
public void reject(User assistant, Request request, String comment, String commentForStudent) {
if (!request.getAssistant().equals(assistant) && !(assistant.teaches(request.getAssignment().getCourse()) || assistant.isAdmin())) {
if (!assistant.equals(request.getAssistant()) && !(assistant.teaches(request.getAssignment().getCourse()) || assistant.isAdmin())) {
throw new IllegalArgumentException("You cannot reject a request that is not assigned to you.");
}
request.addEvent(new RequestRejectedEvent(request, assistant,LocalDateTime.now(), comment, commentForStudent));
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment