From d27ffc28e4c8e315368236ca66f893440e7201d7 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Sun, 9 Sep 2012 07:14:28 +0000 Subject: [PATCH] Fixes NullPointerException thrown when a call is received and there's no available media device. --- .../impl/gui/main/call/PreCallDialog.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java index c3cc565d7..8fda98567 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java @@ -16,11 +16,15 @@ import net.java.sip.communicator.util.swing.*; import org.jitsi.service.neomedia.*; +import org.jitsi.service.neomedia.device.*; import org.jitsi.util.*; import com.explodingpixels.macwidgets.*; /** + * The PreCallDialog is a dialog allowing to pick-up or hangup a call. + * This is the parent dialog of the ReceivedCallDialog and the + * ChooseCallAccountDialog. * * @author Yana Stamcheva */ @@ -153,9 +157,13 @@ public PreCallDialog(String title, String text, Object[] accounts, this.video = video; this.mergeCall = existingCall; + MediaDevice mediaDevice + = GuiActivator.getMediaService().getDefaultDevice( + MediaType.VIDEO, MediaUseCase.CALL); + // check whether we have device enabled for capturing(sending) - this.video = video && GuiActivator.getMediaService().getDefaultDevice( - MediaType.VIDEO, MediaUseCase.CALL).getDirection().allowsSending(); + if (mediaDevice != null) + this.video = video && mediaDevice.getDirection().allowsSending(); this.initComponents(); }