From adefa40dcc0231b7977640f178a1b7d18921afbf Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 26 Jul 2016 08:32:25 -0500 Subject: [PATCH] Simplifies code, reduces the scope of "try". --- conference.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/conference.js b/conference.js index 7ba63a69f..1c041592c 100644 --- a/conference.js +++ b/conference.js @@ -1294,19 +1294,18 @@ export default { APP.UI.addListener(UIEvents.PINNED_ENDPOINT, (smallVideo, isPinned) => { var smallVideoId = smallVideo.getId(); - try { - if (smallVideo.getVideoType() === VIDEO_CONTAINER_TYPE - && !APP.conference.isLocalId(smallVideoId)) - if (isPinned) - room.pinParticipant(smallVideoId); - // When the library starts supporting multiple pins we would - // pass the isPinned parameter together with the identifier, - // but currently we send null to indicate that we unpin the - // last pinned. - else - room.pinParticipant(null); - } catch (e) { - reportError(e); + if (smallVideo.getVideoType() === VIDEO_CONTAINER_TYPE + && !APP.conference.isLocalId(smallVideoId)) { + + // When the library starts supporting multiple pins we would + // pass the isPinned parameter together with the identifier, + // but currently we send null to indicate that we unpin the + // last pinned. + try { + room.pinParticipant(isPinned ? smallVideoId : null); + } catch (e) { + reportError(e); + } } });