null description causes errors

This commit is contained in:
Robert McRackan 2021-09-24 08:24:16 -04:00
parent db84c9a7d9
commit d2ff19e309
2 changed files with 3 additions and 3 deletions

View File

@ -99,8 +99,8 @@ namespace DataLayer
Category = category; Category = category;
// simple assigns // simple assigns
Title = title.Trim(); Title = title.Trim() ?? "";
Description = description?.Trim(); Description = description?.Trim() ?? "";
LengthInMinutes = lengthInMinutes; LengthInMinutes = lengthInMinutes;
ContentType = contentType; ContentType = contentType;

View File

@ -252,7 +252,7 @@ namespace LibationWinForms
private static string GetDescriptionDisplay(Book book) private static string GetDescriptionDisplay(Book book)
{ {
var doc = new HtmlAgilityPack.HtmlDocument(); var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(book.Description); doc.LoadHtml(book?.Description ?? "");
var noHtml = doc.DocumentNode.InnerText; var noHtml = doc.DocumentNode.InnerText;
return return
noHtml.Length < 63 ? noHtml.Length < 63 ?