diff --git a/src/Quartz.Impl.MongoDB/JobStore.cs b/src/Quartz.Impl.MongoDB/JobStore.cs index 7dcfcd8..ab50102 100644 --- a/src/Quartz.Impl.MongoDB/JobStore.cs +++ b/src/Quartz.Impl.MongoDB/JobStore.cs @@ -362,7 +362,7 @@ public virtual void StoreJobAndTrigger(IJobDetail newJob, IOperableTrigger newTr public virtual bool IsJobGroupPaused(string groupName) { var result = this.PausedJobGroups.FindOneByIdAs(groupName); - return !result.IsBsonNull; + return result != null && !result.IsBsonNull; } /// @@ -373,7 +373,7 @@ public virtual bool IsJobGroupPaused(string groupName) public virtual bool IsTriggerGroupPaused(string groupName) { var result = this.PausedTriggerGroups.FindOneByIdAs(groupName); - return !result.IsBsonNull; + return result != null && !result.IsBsonNull; } /// @@ -829,6 +829,20 @@ public virtual void StoreCalendar(string name, ICalendar calendar, bool replaceE } } + /// + /// Determine whether a with the given identifier already + /// exists within the scheduler. + /// + /// calName the identifier to check for + /// true if a Calendar exists with the given identifier + public bool CalendarExists(string calName) + { + lock (lockObject) + { + return this.Calendars.FindOneByIdAs(calName) != null; + } + } + /// /// Remove (delete) the with the /// given name.