Commit 1c647ec2 authored by Andreas Traczyk's avatar Andreas Traczyk

video: catch out of range exception when setting time

Change-Id: I4540324904ddd152d40169d47a7a5e3cddf0d358
parent 03046850
......@@ -88,32 +88,33 @@ void
VideoOverlay::setTime()
{
if (callId.empty()) { return; }
auto callInfo = LRCInstance::getCurrentCallModel()->getCall(callId);
if(callInfo.status == lrc::api::call::Status::IN_PROGRESS) {
int numSeconds = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::steady_clock::now() - callInfo.startTime).count();
QString labelSec;
QString labelMin;
int numMinutes = numSeconds / 60;
int remainder = numSeconds - numMinutes * 60;
if (remainder < 10) {
labelSec = ":0" + QString::number(remainder);
} else {
labelSec = ":" + QString::number(remainder);
try {
auto callInfo = LRCInstance::getCurrentCallModel()->getCall(callId);
if (callInfo.status == lrc::api::call::Status::IN_PROGRESS) {
int numSeconds = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::steady_clock::now() - callInfo.startTime).count();
QString labelSec;
QString labelMin;
int numMinutes = numSeconds / 60;
int remainder = numSeconds - numMinutes * 60;
if (remainder < 10) {
labelSec = ":0" + QString::number(remainder);
} else {
labelSec = ":" + QString::number(remainder);
}
if (numMinutes < 10) {
labelMin = "0" + QString::number(numMinutes);
} else {
labelMin = QString::number(numMinutes);
}
ui->timerLabel->setText(labelMin + labelSec);
}
if (numMinutes < 10) {
labelMin = "0" + QString::number(numMinutes);
} else {
labelMin = QString::number(numMinutes);
}
ui->timerLabel->setText(labelMin + labelSec);
}
} catch (...) { }
}
void VideoOverlay::toggleContextButtons(bool visible)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment