diff --git a/mythtv/libs/libmythbase/mythcommandlineparser.cpp b/mythtv/libs/libmythbase/mythcommandlineparser.cpp index b60130e7906..1497ef5ca63 100644 --- a/mythtv/libs/libmythbase/mythcommandlineparser.cpp +++ b/mythtv/libs/libmythbase/mythcommandlineparser.cpp @@ -259,6 +259,17 @@ QString CommandLineArg::GetHelpString(int off, QString group, bool force) const QString helpstr; QTextStream msg(&helpstr, QIODevice::WriteOnly); int termwidth = GetTermWidth(); + if (termwidth < off) + { + if (off > 70) + // developer has configured some absurdly long command line + // arguments, but we still need to do something + termwidth = off+40; + else + // user is running uselessly narrow console, use a sane console + // width instead + termwidth = 79; + } if (m_help.isEmpty() && !force) // only print if there is a short help to print diff --git a/mythtv/libs/libmythbase/mythmiscutil.cpp b/mythtv/libs/libmythbase/mythmiscutil.cpp index 4fb0c61af7d..dc47e1d823a 100644 --- a/mythtv/libs/libmythbase/mythmiscutil.cpp +++ b/mythtv/libs/libmythbase/mythmiscutil.cpp @@ -943,6 +943,10 @@ void wrapList(QStringList &list, int width) { int i; + // if this is triggered, something has gone seriously wrong + // the result won't really be usable, but at least it won't crash + width = max(width, 5); + for(i = 0; i < list.size(); i++) { QString string = list.at(i);