Skip to content

Commit c68cf99

Browse files
authored
fix: Add missing check for payload (#719)
Signed-off-by: Oleg Kopysov <o.kopysov@samsung.com>
1 parent 9570aa9 commit c68cf99

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/lpvs/util/LPVSPayloadUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,12 @@ public static boolean checkPayload(String payload) {
195195

196196
Gson gson = new Gson();
197197
JsonObject json = gson.fromJson(payload, JsonObject.class);
198+
if (json == null || json.get("action") == null) {
199+
log.error("'action' field is not presented in the payload.");
200+
return false;
201+
}
198202
String actionString = json.get("action").getAsString();
199-
log.debug("Action " + actionString);
203+
log.debug("Action {}", actionString);
200204
LPVSPullRequestAction action = LPVSPullRequestAction.convertFrom(actionString);
201205
return (action != null)
202206
&& (action.equals(LPVSPullRequestAction.UPDATE)

0 commit comments

Comments
 (0)