Skip to content

Commit 3bb9307

Browse files
committed
fixes issue 229
1 parent 175a7b9 commit 3bb9307

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,15 @@ function tincanlaunch_get_file_areas($course, $cm, $context) {
326326
function tincanlaunch_get_file_info($browser, $areas, $context, $filearea, $filepath, $filename) {
327327
global $CFG;
328328

329+
// Ensure $context is a proper context object (not just stdClass).
330+
if (!($context instanceof \context)) {
331+
if (isset($context->id)) {
332+
$context = \context::instance_by_id($context->id);
333+
} else {
334+
return null;
335+
}
336+
}
337+
329338
if (!has_capability('moodle/course:managefiles', $context)) {
330339
return null;
331340
}

0 commit comments

Comments
 (0)