diff --git a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java index 71e1c04..8c899ce 100644 --- a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java +++ b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java @@ -51,10 +51,13 @@ throw new WebApplicationException(400); } Account account = accounts.getAccount(uid); + if(account == null){ + throw new WebApplicationException(400); + } String server_token = account.getToken(); if (client_token.equals(server_token)) { String vid = createVid(); - String path = null; + String path = ""; try { path = Base64Decode.saveAsFile(vid, data); } catch (IOException e) { @@ -80,6 +83,9 @@ throw new WebApplicationException(400); } Account account = accounts.getAccount(uid); + if(account == null){ + throw new WebApplicationException(400); + } String server_token = account.getToken(); if (client_token.equals(server_token)) { Voicememo voicememo = voicememos.getVoicememo(vid); @@ -97,6 +103,9 @@ throw new WebApplicationException(400); } Account account = accounts.getAccount(uid); + if(account == null){ + throw new WebApplicationException(400); + } String server_token = account.getToken(); if (client_token.equals(server_token)) { Voicememo v = voicememos.getVoicememo(vid); @@ -115,6 +124,9 @@ throw new WebApplicationException(400); } Account account = accounts.getAccount(uid); + if(account == null){ + throw new WebApplicationException(400); + } String server_token = account.getToken(); if (client_token.equals(server_token)) { voicememos.removeVoicememo(vid);