refactor: doesn't crash tab, and doesn't cause errors

This commit is contained in:
knownotunknown
2024-03-10 23:49:01 -05:00
parent 261d2f2e84
commit 00502657f4

View File

@@ -10,14 +10,16 @@ export class CourseSchedule {
meetings: CourseMeeting[]; meetings: CourseMeeting[];
constructor(courseSchedule?: Serialized<CourseSchedule>) { constructor(courseSchedule?: Serialized<CourseSchedule>) {
this.meetings = [];
if (!courseSchedule) { if (!courseSchedule) {
return; return;
} }
Object.assign(this, courseSchedule); Object.assign(this, courseSchedule);
this.meetings = []; let newMeetings = [];
for (let meeting of courseSchedule.meetings) { for (let meeting of courseSchedule.meetings) {
this.meetings.push(new CourseMeeting(meeting)); newMeetings.push(new CourseMeeting(meeting));
} }
this.meetings = newMeetings;
} }
/** /**