Commit 6a17fc4
authored
Fix null pointer exception in ElementBlogPosts Categories() call (#49)
* Fix null pointer exception in ElementBlogPosts
Add null check for blog object before calling Categories() method.
This prevents "Call to a member function Categories() on null" error
when Blog::get()->byID($val) returns null for non-existent blog IDs.
Fixes issue where attempting to edit an ElementBlogPosts element
with an invalid or deleted blog ID would cause a fatal error.
* Add explicit return statement for null blog case
Address Copilot review feedback by adding explicit return []
when blog is null for better code clarity and consistency.
This makes the control flow more explicit and easier to understand.1 parent f4a98d1 commit 6a17fc4
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| |||
0 commit comments