@@ -129,7 +129,11 @@ protected Boolean doInBackground(Void... voids) {
129129 activityText = course .activity ;
130130 locationText = courseCodeText + " - " + course .meetings .get (0 ).building_code + " " + course .meetings .get (0 ).room_number ;
131131 courseTitleText = course .course_title ;
132- instructorsText = course .instructors .get (0 ).name ;
132+ try {
133+ instructorsText = course .instructors .get (0 ).name ;
134+ } catch (IndexOutOfBoundsException e ) {
135+ instructorsText = getString (R .string .professor_missing );
136+ }
133137 courseDescription = course .course_description ;
134138 return true ;
135139 } catch (Exception ignored ) {
@@ -140,7 +144,7 @@ protected Boolean doInBackground(Void... voids) {
140144 @ Override
141145 protected void onPostExecute (Boolean valid ) {
142146 if (!valid || courses .size () == 0 ) {
143- courseCodeTextView .setText (input );
147+ courseCodeTextView .setText (courseCodeText );
144148 courseTitleTextView .setText (input + " is not currently offered." );
145149 return ;
146150 }
@@ -157,6 +161,9 @@ protected void onPostExecute(Boolean valid) {
157161 courseActivityTextView .setText (activityText );
158162 courseTitleTextView .setText (courseTitleText );
159163 instructorTextView .setText (instructorsText );
164+ if (instructorsText .equals (getString (R .string .professor_missing ))) {
165+ instructorTextView .setTextColor (getResources ().getColor (R .color .color_primary_light ));
166+ }
160167
161168 if (courseDescription .equals ("" )) {
162169 descriptionTitle .setVisibility (View .GONE );
0 commit comments