Allow for no "cumulative" line
[tpope-extra.git] / perl / schedproc
index 81f4a1aec943be197811efe3cfe9675544930d98..2a80bc3df745f296e61985445c172f254d6c1f81 100755 (executable)
@@ -586,13 +586,15 @@ sub do_html_grades {
            print "</td></tr>\n";
        }
     }
-    my $lastrow = $grades->{'cumulative'}->[scalar @{$grades->{'cumulative'}}-1];
-    print '<tr class="cumulative '.$shade.'"><td id="cumulative" colspan="2">Cumulative: through ', capitalize($lastrow->{'term'});
-    print '</td><td align="center" id="gpa" class="grade">';
-    print $lastrow->{'gpa'};
-    print '</td><td align="right" class="right-number">';
-    print join('</td><td align="right" class="right-number">', ($lastrow->{'earned'}, $lastrow->{'hours'}, $lastrow->{'points'}));
-    print "</td></tr>\n";
+    if(exists($grades->{'cumulative'})) {
+        my $lastrow = $grades->{'cumulative'}->[scalar @{$grades->{'cumulative'}}-1];
+        print '<tr class="cumulative '.$shade.'"><td id="cumulative" colspan="2">Cumulative: through ', capitalize($lastrow->{'term'});
+        print '</td><td align="center" id="gpa" class="grade">';
+        print $lastrow->{'gpa'};
+        print '</td><td align="right" class="right-number">';
+        print join('</td><td align="right" class="right-number">', ($lastrow->{'earned'}, $lastrow->{'hours'}, $lastrow->{'points'}));
+        print "</td></tr>\n";
+    }
     print "</table>\n";
     select STDOUT;
 }