Merge pull request #2537 from dpalou/MOBILE-3530
MOBILE-3530 course: Fix error when removing course files with site pl…main
commit
7d48aa1cd7
|
@ -730,10 +730,10 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate {
|
||||||
getModuleFiles(module: any, courseId: number): Promise<any[]> {
|
getModuleFiles(module: any, courseId: number): Promise<any[]> {
|
||||||
const handler = this.getPrefetchHandlerFor(module);
|
const handler = this.getPrefetchHandlerFor(module);
|
||||||
|
|
||||||
if (handler.getFiles) {
|
if (handler && handler.getFiles) {
|
||||||
// The handler defines a function to get files, use it.
|
// The handler defines a function to get files, use it.
|
||||||
return Promise.resolve(handler.getFiles(module, courseId));
|
return Promise.resolve(handler.getFiles(module, courseId));
|
||||||
} else if (handler.loadContents) {
|
} else if (handler && handler.loadContents) {
|
||||||
// The handler defines a function to load contents, use it before returning module contents.
|
// The handler defines a function to load contents, use it before returning module contents.
|
||||||
return handler.loadContents(module, courseId).then(() => {
|
return handler.loadContents(module, courseId).then(() => {
|
||||||
return module.contents;
|
return module.contents;
|
||||||
|
|
Loading…
Reference in New Issue