diff --git a/src/ChamiloLMS/Transaction/TransactionLogController.php b/src/ChamiloLMS/Transaction/TransactionLogController.php index 22088da4bc..345b6c4168 100644 --- a/src/ChamiloLMS/Transaction/TransactionLogController.php +++ b/src/ChamiloLMS/Transaction/TransactionLogController.php @@ -567,6 +567,9 @@ class TransactionLogController try { $blob_metadata = Envelope::identifyBlobMetadata($blob); $origin_branch = $this->branchRepository->find($blob_metadata['origin_branch_id']); + if (!$origin_branch) { + throw new Exception(sprintf('Cannot find a local branch with id %s', $blob_metadata['origin_branch_id'])); + } $wrapper_plugin = self::createPlugin('wrapper', $blob_metadata['blob_type'], $origin_branch->getPluginData('wrapper')); $envelope_data = array('blob' => $blob, 'origin_branch_id' => $blob_metadata['origin_branch_id']); $envelope = new Envelope($wrapper_plugin, $envelope_data);