diff --git a/daemon/src/video/video_encoder.cpp b/daemon/src/video/video_encoder.cpp index 08f79898b01aef29e2c6804068221f8e7df767e3..f584e985fdfc40fbd0ff22e027388b02b3b14325 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};