div为空跳过,不报错

This commit is contained in:
nilaoda 2022-09-27 14:50:11 +08:00
parent 408736d2db
commit 34ca046562
1 changed files with 3 additions and 0 deletions

View File

@ -226,6 +226,9 @@ namespace Mp4SubtitleParser
continue; continue;
var _div = bodyNode.SelectSingleNode("ns:div", nsMgr); var _div = bodyNode.SelectSingleNode("ns:div", nsMgr);
if (_div == null)
continue;
//Parse <p> label //Parse <p> label
foreach (XmlElement _p in _div!.SelectNodes("ns:p", nsMgr)!) foreach (XmlElement _p in _div!.SelectNodes("ns:p", nsMgr)!)
{ {