From f229b6f4599d1ab48f9632b9bce0ea94b47e06b6 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Tue, 6 Jan 2015 17:14:26 -0500
Subject: [PATCH] daemon: fix crash when no video device is present

Refs #63235

Change-Id: I05a2f65eedc1c83027573011de9cca31812cfcbb
---
 daemon/src/video/video_encoder.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/daemon/src/video/video_encoder.cpp b/daemon/src/video/video_encoder.cpp
index 08f79898b0..f584e985fd 100644
--- a/daemon/src/video/video_encoder.cpp
+++ b/daemon/src/video/video_encoder.cpp
@@ -492,13 +492,15 @@ void VideoEncoder::prepareEncoderContext(bool is_video)
 
     if (is_video) {
         // resolution must be a multiple of two
-        char *width = av_dict_get(options_, "width", NULL, 0)->value;
+        auto width_param = av_dict_get(options_, "width", NULL, 0);
+        char *width = width_param ? width_param->value : nullptr;
         dstWidth_ = encoderCtx_->width = width ? atoi(width) : 0;
-        char *height = av_dict_get(options_, "height", NULL, 0)->value;
+        auto height_param = av_dict_get(options_, "height", NULL, 0);
+        char *height = height_param ? height_param->value : nullptr;
         dstHeight_ = encoderCtx_->height = height ? atoi(height) : 0;
 
-        const char *framerate = av_dict_get(options_, "framerate",
-                                            NULL, 0)->value;
+        auto framerate_param = av_dict_get(options_, "framerate", NULL, 0);
+        const char *framerate =  framerate_param ? framerate_param->value : nullptr;
         const int DEFAULT_FPS = 30;
         const int fps = framerate ? atoi(framerate) : DEFAULT_FPS;
         encoderCtx_->time_base = (AVRational) {1, fps};
-- 
GitLab