Skip to content

Commit 7294b7b

Browse files
author
rtschu
committed
fixed some small errors
1 parent 1b5b9b7 commit 7294b7b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: classes/search/moodleoverflowposts.php

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ private function get_moodleoverflow_from_id($moodleoverflowid) {
100100
public function check_access($id) {
101101
try {
102102
$post = moodleoverflow_get_post_full($id);
103+
if (!$post) {
104+
return \core_search\manager::ACCESS_DELETED;
105+
}
103106
if (!$discussion = $this->get_discussion_from_id($post->discussion)) {
104107
return \core_search\manager::ACCESS_DELETED;
105108
}

Diff for: locallib.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ function moodleoverflow_get_post_full($postid) {
473473
$params['postid'] = $postid;
474474

475475
$post = $DB->get_record_sql($sql, $params);
476-
if ($post->userid === 0) {
476+
if (isset($post->userid) && $post->userid === 0) {
477477
$post->message = get_string('privacy:anonym_post_message', 'mod_moodleoverflow');
478478
}
479479

0 commit comments

Comments
 (0)