From b38641ecb5d5a47d8fc4bf4e8aa3d1ebc1fe97ee Mon Sep 17 00:00:00 2001 From: Paul Trudel <35616208+paultrudel@users.noreply.github.com> Date: Thu, 16 Nov 2023 09:44:55 -0300 Subject: [PATCH] fix (bbb-web): Null pointer exception when parent meeting does not exist --- .../bigbluebutton/api/ParamsProcessorUtil.java | 5 +++++ .../web/controllers/ApiController.groovy | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java index 6ab1604b0f..007ab26f1a 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java @@ -1152,6 +1152,11 @@ public class ParamsProcessorUtil { return true; } + public boolean parentMeetingExists(String parentMeetingId) { + Meeting meeting = ServiceUtils.findMeetingFromMeetingID(parentMeetingId); + return meeting != null; + } + /************************************************* * Setters ************************************************/ diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index 9eee398ae7..4bae5b7714 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -130,9 +130,20 @@ class ApiController { return } - if(params.isBreakout == "true" && !params.parentMeetingID) { - invalid("parentMeetingIDMissing", "No parent meeting ID was provided for the breakout room") - return + Boolean isBreakoutRoom = false + if (!StringUtils.isEmpty(params.isBreakout)) { + isBreakoutRoom = Boolean.parseBoolean(params.isBreakout) + } + + if(isBreakoutRoom) { + if(StringUtils.isEmpty(params.parentMeetingID)) { + invalid("parentMeetingIDMissing", "No parent meeting ID was provided for the breakout room") + return + } + if(!paramsProcessorUtil.parentMeetingExists(params.parentMeetingID)) { + invalid("parentMeetingDoesNotExist", "No parent meeting exists for the breakout room") + return + } } // Ensure unique TelVoice. Uniqueness is not guaranteed by paramsProcessorUtil.