@@ -128,7 +128,9 @@ export default {
128128 }
129129
130130 this .currently = CURRENTLY .CALCULATING ;
131- const gpa = await this .calculate_cumulative_gpa (this .courses , this .currentTerm , this .secondSemester ).catch (() => null );
131+ const gpa = await this .calculate_cumulative_gpa (this .courses , this .currentTerm , this .secondSemester ).catch ((err ) => {
132+ console .log (" Error in cumulative GPA calculation " + err);
133+ });
132134 if (gpa) {
133135 this .gpa = gpa .toFixed (2 );
134136 this .currently = CURRENTLY .DONE ;
@@ -149,7 +151,12 @@ export default {
149151 .then (data => {
150152 const el = document .createElement (" html" );
151153 el .innerHTML = data;
152- const current_term_history = el .getElementsByClassName (" selected" )[0 ].textContent .split (" - " )[0 ];
154+ let current_term_history = el .getElementsByClassName (" selected" );
155+ if (current_term_history .length !== 0 ) {
156+ current_term_history = current_term_history[0 ].textContent .split (" - " )[0 ];
157+ } else {
158+ current_term_history = undefined ;
159+ }
153160 const tabs = el .getElementsByClassName (" tabs" )[0 ].getElementsByTagName (" li" );
154161 // Iterate until the end of tabs or until no longer at a high school semester
155162 for (let i = 0 ; i < tabs .length && / HS$ / .test (tabs[i].innerText ); i++ ) {
@@ -190,7 +197,6 @@ export default {
190197 }));
191198 }
192199 // Calculates cumulative GPA based on credit hours per semester and gpa for each semester.
193-
194200 const cumulative_gpa = Promise .all (fetches).then (function () {
195201 let include_current_semester = false ;
196202 if (current_courses .length !== 0 ) {
0 commit comments