From 74325364956e4cc12348c869636ec8a462b924da Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 11 Dec 2021 14:55:42 +0100 Subject: [PATCH] Improve error handling --- src/libse/SubtitleFormats/TimedText10.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libse/SubtitleFormats/TimedText10.cs b/src/libse/SubtitleFormats/TimedText10.cs index 9f5da25dc..36d26da0d 100644 --- a/src/libse/SubtitleFormats/TimedText10.cs +++ b/src/libse/SubtitleFormats/TimedText10.cs @@ -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; }