mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19109: Fixing NRE when deleting tasks not associated with content items
Work Item: 19109 --HG-- branch : 1.x
This commit is contained in:
@@ -56,7 +56,8 @@ namespace Orchard.Core.Scheduling.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteTasks(ContentItem contentItem, Func<IScheduledTask, bool> predicate = null ) {
|
public void DeleteTasks(ContentItem contentItem, Func<IScheduledTask, bool> predicate = null ) {
|
||||||
var tasks = _repository
|
// if contentItem is null, all tasks are used
|
||||||
|
var tasks = contentItem == null ? _repository.Table : _repository
|
||||||
.Fetch(x => x.ContentItemVersionRecord.ContentItemRecord == contentItem.Record);
|
.Fetch(x => x.ContentItemVersionRecord.ContentItemRecord == contentItem.Record);
|
||||||
|
|
||||||
foreach (var task in tasks) {
|
foreach (var task in tasks) {
|
||||||
|
Reference in New Issue
Block a user