Improve error handling

This commit is contained in:
niksedk 2021-12-11 14:55:42 +01:00
parent e864dbbe18
commit 7432536495

View File

@ -1355,6 +1355,16 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var nsmgr = new XmlNamespaceManager(xml.NameTable);
nsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
XmlNode head = xml.DocumentElement.SelectSingleNode("ttml:head", nsmgr);
if (head == null)
{
head = xml.DocumentElement.SelectSingleNode("head", nsmgr);
}
if (head == null)
{
return list;
}
foreach (XmlNode node in head.SelectNodes("//ttml:style", nsmgr))
{
if (node.Attributes["xml:id"] != null)
@ -1369,7 +1379,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
}
catch
{
// Ignore
}
return list;
}