diff --git a/src/Dfe.PlanTech.Infrastructure.Redis/RedisCache.cs b/src/Dfe.PlanTech.Infrastructure.Redis/RedisCache.cs index 5be158f58..c07cb7b78 100644 --- a/src/Dfe.PlanTech.Infrastructure.Redis/RedisCache.cs +++ b/src/Dfe.PlanTech.Infrastructure.Redis/RedisCache.cs @@ -259,13 +259,17 @@ private async Task> GetDependenciesAsync(T value) /// private async Task> GetContentDependenciesAsync(ContentComponent value) { + // RichText is a sub-component that doesn't have SystemDetails, exit for such types + if (value.Sys is null) + return []; + // add the item itself as a dependency var results = new List { value.Sys.Id }; var properties = value.GetType().GetProperties(); foreach (var property in properties) { - if (property.PropertyType == typeof(ContentComponent) || typeof(IEnumerable).IsAssignableFrom(property.PropertyType)) + if (typeof(ContentComponent).IsAssignableFrom(property.PropertyType) || typeof(IEnumerable).IsAssignableFrom(property.PropertyType)) { var nestedDependencies = await GetDependenciesAsync(property.GetValue(value)); results.AddRange(nestedDependencies);