Skip to content

Commit

Permalink
Put subtitle reading inside a try/catch statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdude42 committed Aug 28, 2020
1 parent bde82fc commit 86aaac8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions mythtv/libs/libmythtv/captions/textsubtitleparser.cpp
Expand Up @@ -358,12 +358,19 @@ void TextSubtitleParser::LoadSubtitles(const QString &fileName,
sub_data.rbuffer_text = ba.data();
sub_data.rbuffer_len = ba.size();

if (!sub_read_file(&sub_data))
try
{
// Don't delete[] sub_data.rbuffer_text; because the
// QByteArray destructor will clean up.
LOG(VB_VBI, LOG_ERR, QString("Failed to read subtitles from '%1'")
.arg(fileName));
if (!sub_read_file(&sub_data))
{
// Don't delete[] sub_data.rbuffer_text; because the
// QByteArray destructor will clean up.
LOG(VB_VBI, LOG_ERR, QString("Failed to read subtitles from '%1'")
.arg(fileName));
return;
}
} catch (std::exception& e) {
LOG(VB_VBI, LOG_ERR,
QString("Exception reading subtitles file (%1)").arg(e.what()));
return;
}

Expand Down

0 comments on commit 86aaac8

Please sign in to comment.