Fix NPE retriving history if the editor is null.

This commit is contained in:
Paulo Gustavo Veiga 2012-08-27 22:24:59 -03:00
parent e42af6a952
commit 30c13905c0

View File

@ -2,6 +2,7 @@ package com.wisemapping.rest.model;
import com.wisemapping.model.MindMapHistory; import com.wisemapping.model.MindMapHistory;
import com.wisemapping.model.User;
import org.codehaus.jackson.annotate.JsonAutoDetect; import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -38,7 +39,8 @@ public class RestMindmapHistory {
public RestMindmapHistory(@NotNull MindMapHistory history) { public RestMindmapHistory(@NotNull MindMapHistory history) {
this.id = history.getId(); this.id = history.getId();
this.creation = history.getCreationTime(); this.creation = history.getCreationTime();
this.creator = history.getEditor().getFullName(); final User editor = history.getEditor();
this.creator = editor != null ? editor.getFullName() : "";
} }
public String getCreationTime() { public String getCreationTime() {