Skip to content

Commit

Permalink
Ensure that the authentication instance is created only when the input
Browse files Browse the repository at this point in the history
prinicipal is not null.
  • Loading branch information
Kavin committed Sep 7, 2016
1 parent 7642f63 commit 5a45c9e
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -719,7 +719,10 @@ protected Note importNote(NotebookSocket conn, HashSet<String> userAndRoles,
if (fromMessage != null) {
String noteName = (String) ((Map) fromMessage.get("notebook")).get("name");
String noteJson = gson.toJson(fromMessage.get("notebook"));
AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal);
AuthenticationInfo subject = null;
if (fromMessage.principal != null) {
subject = new AuthenticationInfo(fromMessage.principal);
}
note = notebook.importNote(noteJson, noteName, subject);
note.persist(subject);
broadcastNote(note);
Expand Down

0 comments on commit 5a45c9e

Please sign in to comment.