From 35b15e7fb15715aa2eb46f38df84330ea350783e Mon Sep 17 00:00:00 2001 From: Ezerous Date: Thu, 4 Jul 2019 10:56:43 +0300 Subject: [PATCH] Fix for unsupported courses --- .../activities/upload/UploadActivity.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java index d6fb274a..dcf9b90e 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java @@ -940,14 +940,16 @@ public class UploadActivity extends BaseActivity { String retrievedCourse = maybeCourse.replaceAll("-", "").replace("(ΝΠΣ)", "").trim(); String retrievedSemester = maybeSemester.replaceAll("-", "").trim().substring(0, 1); - UploadsCourse foundUploadsCourse = UploadsCourse.findCourse(retrievedCourse, uploadsCourses); - - if(foundUploadsCourse != null){ - uploadsCourse = foundUploadsCourse; - semester = retrievedSemester; - Timber.d("Selected course: %s, semester: %s", uploadsCourse.getName(), semester); - titleDescriptionBuilderButton.setEnabled(true); - return; + if(!retrievedCourse.isEmpty()){ + UploadsCourse foundUploadsCourse = UploadsCourse.findCourse(retrievedCourse, uploadsCourses); + + if(foundUploadsCourse != null){ + uploadsCourse = foundUploadsCourse; + semester = retrievedSemester; + Timber.d("Selected course: %s, semester: %s", uploadsCourse.getName(), semester); + titleDescriptionBuilderButton.setEnabled(true); + return; + } } titleDescriptionBuilderButton.setEnabled(false);