     init(allschedules: Allschedules?) {
         guard allschedules != nil else { return }
         self.expandedData = [NSDictionary]()
-        self.scheduleConfiguration = allschedules!.getallschedules()
+        self.scheduleConfiguration = allschedules?.getallschedules()
         self.setallscheduledtasksNSDictionary()
         self.sortAndExpandScheduleTasks()
     }

                    break
                }
            }
            self.sortedschedules = self.expandedData!.sorted { (di1, di2) -> Bool in
                if (di1.value(forKey: "start") as? Date)!.timeIntervalSince((di2.value(forKey: "start") as? Date)!) > 0 {
                    return false
                } else {

    /// array of NSDictionary.
    /// - returns : none
    private func setallscheduledtasksNSDictionary() {
        var data = [NSDictionary]()
        for i in 0 ..< (self.scheduleConfiguration?.count ?? 0) where
            self.scheduleConfiguration![i].dateStop != nil && self.scheduleConfiguration![i].schedule != Scheduletype.stopped.rawValue {
            let dict: NSDictionary = [
                "dateStart": self.scheduleConfiguration?[i].dateStart ?? "",
                "dateStop": self.scheduleConfiguration?[i].dateStop ?? "",
                "hiddenID": self.scheduleConfiguration?[i].hiddenID ?? -1,
                "schedule": self.scheduleConfiguration?[i].schedule ?? "",
                "profilename": self.scheduleConfiguration![i].profilename ?? NSLocalizedString("Default profile", comment: "default profile"),
            ]
            data.append(dict as NSDictionary)
