aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-03-23 19:08:55 +0300
committerGravatar Vitaly Takmazov2021-03-23 19:43:29 +0300
commit29c0732ab7a74f789d27553fb5019c28a402fdff (patch)
tree9148b5b7408543b52889a7ecd5f8e92079253c06 /src/main/java/com/juick/www
parentac54a37a72cea61f06e5818a3402667c6b2caa5c (diff)
Fix email processing flow
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/api/Service.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/juick/www/api/Service.java b/src/main/java/com/juick/www/api/Service.java
index 8b18b125..c3ce1242 100644
--- a/src/main/java/com/juick/www/api/Service.java
+++ b/src/main/java/com/juick/www/api/Service.java
@@ -98,8 +98,11 @@ public class Service {
return;
}
}
- String from = msg.getFrom() == null || msg.getFrom().length > 1 ? ((InternetAddress) msg.getSender()).getAddress()
- : ((InternetAddress) msg.getFrom()[0]).getAddress();
+ if (msg.getFrom() == null || msg.getFrom().length == 0) {
+ logger.info("Missing from/sender headers");
+ return;
+ }
+ String from = ((InternetAddress) msg.getFrom()[0]).getAddress();
User visitor = userService.getUserByEmail(from);
if (!visitor.isAnonymous()) {