summaryrefslogtreecommitdiff
path: root/ws.go
diff options
context:
space:
mode:
Diffstat (limited to 'ws.go')
-rw-r--r--ws.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/ws.go b/ws.go
index 764bbbd..7cc6aab 100644
--- a/ws.go
+++ b/ws.go
@@ -327,7 +327,11 @@ func handleConn(
return protocolError(ctx, c, "Course ID must be an integer")
}
courseID := int(_courseID)
- course := courses[courseID]
+ course := func() *courseT {
+ coursesLock.RLock()
+ defer coursesLock.RUnlock()
+ return courses[courseID]
+ }()
err = func() error {
tx, err := db.Begin(ctx)