Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make mythtranscode fail gracefully on file not found

Fixes #9427

If a recording doesn't exist, or the recording exists, but is not in the
database, mythtranscode will gracefully refuse to transcode it, rather than
crash.

Also, make the MythContext object be on the stack of main(), such that any exit
from the system will hit the dtor, causing a cleaner shutdown.
  • Loading branch information...
commit ca4001dabf3f4c140ae83effc2c7927ab7fd1352 1 parent d9c4bd1
@Beirdo Beirdo authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 mythtv/programs/mythtranscode/main.cpp
View
12 mythtv/programs/mythtranscode/main.cpp
@@ -515,7 +515,8 @@ int main(int argc, char *argv[])
print_verbose_messages = VB_NONE;
// Load the context
- gContext = new MythContext(MYTH_BINARY_VERSION);
+ MythContext context(MYTH_BINARY_VERSION);
+ gContext = &context;
if (!gContext->Init(false))
{
VERBOSE(VB_IMPORTANT, "Failed to init MythContext, exiting.");
@@ -625,10 +626,16 @@ int main(int argc, char *argv[])
QString("Couldn't find a recording for filename '%1'")
.arg(infile));
delete pginfo;
- pginfo = NULL;
+ return GENERIC_EXIT_NO_RECORDING_DATA;
}
}
+ if (!pginfo)
+ {
+ VERBOSE(VB_IMPORTANT, "No program info found!");
+ return GENERIC_EXIT_NO_RECORDING_DATA;
+ }
+
if (infile.left(7) == "myth://" && (outfile.isNull() || outfile != "-"))
{
VERBOSE(VB_IMPORTANT, QString("Attempted to transcode %1. "
@@ -752,7 +759,6 @@ int main(int argc, char *argv[])
transcode->deleteLater();
- delete gContext;
return exitcode;
}
Please sign in to comment.
Something went wrong with that request. Please try again.