diff --git a/main/CalendarTab/CalendarManager.cpp b/main/CalendarTab/CalendarManager.cpp index 29f23e3..7851a2b 100644 --- a/main/CalendarTab/CalendarManager.cpp +++ b/main/CalendarTab/CalendarManager.cpp @@ -10,8 +10,10 @@ void CalendarManager::setCalendar(std::string html) { caliSchedPtr->setPage(html); } -void CalendarManager::exportCalendarCSV() +void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug { + if (caliSchedPtr->getCourses()->empty()) + return; QMessageBox msgBox; int buttonClicked = caliDialog->exec(); if (buttonClicked == 0) //cancel? diff --git a/src/jceData/CSV/csv_exporter.cpp b/src/jceData/CSV/csv_exporter.cpp index 4ec5a23..e40cc49 100644 --- a/src/jceData/CSV/csv_exporter.cpp +++ b/src/jceData/CSV/csv_exporter.cpp @@ -7,6 +7,8 @@ CSV_Exporter::CSV_Exporter() bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *cal) { + if ((cal == NULL) || (calSched == NULL) || (calSched->getCourses() == NULL)) //pointers checking! + return false; qDebug() << "Getting path for csv file from user..."; QString filePath = getFileFath(); if(filePath == NULL) //User canceled