Add null checks when writing summary text
This commit is contained in:
@@ -39,8 +39,8 @@ namespace Umbraco.Cms.Core.Packaging
|
||||
|
||||
void WriteConflicts<T>(IEnumerable<T> source, Func<T, string> selector, string message, bool appendLine = true)
|
||||
{
|
||||
var result = source.Select(selector).ToList();
|
||||
if (result.Count > 0)
|
||||
var result = source?.Select(selector).ToList();
|
||||
if (result?.Count > 0)
|
||||
{
|
||||
sb.Append(message);
|
||||
sb.Append(string.Join(", ", result));
|
||||
@@ -55,7 +55,7 @@ namespace Umbraco.Cms.Core.Packaging
|
||||
void WriteCount<T>(string message, IEnumerable<T> source, bool appendLine = true)
|
||||
{
|
||||
sb.Append(message);
|
||||
sb.Append(source.Count());
|
||||
sb.Append(source?.Count() ?? 0);
|
||||
|
||||
if (appendLine)
|
||||
{
|
||||
@@ -63,9 +63,9 @@ namespace Umbraco.Cms.Core.Packaging
|
||||
}
|
||||
}
|
||||
|
||||
WriteConflicts(Warnings.ConflictingMacros, x => x.Alias, "Conflicting macros found, they will be overwritten: ");
|
||||
WriteConflicts(Warnings.ConflictingTemplates, x => x.Alias, "Conflicting templates found, they will be overwritten: ");
|
||||
WriteConflicts(Warnings.ConflictingStylesheets, x => x.Alias, "Conflicting stylesheets found, they will be overwritten: ");
|
||||
WriteConflicts(Warnings?.ConflictingMacros, x => x.Alias, "Conflicting macros found, they will be overwritten: ");
|
||||
WriteConflicts(Warnings?.ConflictingTemplates, x => x.Alias, "Conflicting templates found, they will be overwritten: ");
|
||||
WriteConflicts(Warnings?.ConflictingStylesheets, x => x.Alias, "Conflicting stylesheets found, they will be overwritten: ");
|
||||
WriteCount("Data types installed: ", DataTypesInstalled);
|
||||
WriteCount("Languages installed: ", LanguagesInstalled);
|
||||
WriteCount("Dictionary items installed: ", DictionaryItemsInstalled);
|
||||
|
||||
Reference in New Issue
Block a user