From bc7c3143bad874496cc1004c7bfdf7b6721bd1f3 Mon Sep 17 00:00:00 2001 From: Paul Trudel Date: Thu, 19 Oct 2023 19:54:43 +0000 Subject: [PATCH] Prevent null error when parent meeting does not exist --- .../org/bigbluebutton/api/ParamsProcessorUtil.java | 5 +++++ .../web/controllers/ApiController.groovy | 12 +++++++++--- 2 files changed, 14 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 85d70ce4d1..587828197b 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 @@ -1156,6 +1156,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 6384e465f3..88465fe72a 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 @@ -127,9 +127,15 @@ class ApiController { return } - if(params.isBreakout == "true" && !params.parentMeetingID) { - invalid("parentMeetingIDMissing", "No parent meeting ID was provided for the breakout room") - return + if(params.isBreakout == "true") { + if(!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.