Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Call to a member function delete() on null #482

Open
greatestview opened this issue Jul 25, 2023 · 0 comments
Open

Uncaught Error: Call to a member function delete() on null #482

greatestview opened this issue Jul 25, 2023 · 0 comments

Comments

@greatestview
Copy link
Contributor

Got this error message:

Ein Fehler vom Typ E_ERROR wurde in der Zeile 301 der Datei
[…]/wp-content/plugins/grid/lib/grid/classes/Endpoint.php
verursacht. Fehlermeldung: Uncaught Error: Call to a member function
delete() on null in
[…]/wp-content/plugins/grid/lib/grid/classes/Endpoint.php:301
Stack trace:
#0 [internal function]: Palasthotel\Grid\Endpoint->removeBox()
#1 (closed) […]/wp-content/plugins/grid/lib/grid/classes/API.php(118):
ReflectionMethod->invokeArgs()
#2 (closed) […]/wp-content/plugins/grid/classes/TheGrid.php(184):
Palasthotel\Grid\API->handleAjaxCall()
#3 (closed) […]/wp-includes/class-wp-hook.php(307):
Palasthotel\Grid\WordPress\TheGrid->ajax()
#4 (closed) […]/wp-includes/class-wp-hook.php(331):
WP_Hook->apply_filters()
#5 (closed) […]/wp-includes/plugin.php(474):
WP_Hook->do_action()
#6 (closed) […]/wp-admin/admin.php(259):
do_action()
#7 (closed) {main}
thrown

That is happening here:
https://github.com/palasthotel/grid/blob/74db6708401f42b1fffd6ea9053db8b33524fca7/classes/Endpoint.php#L295C1-L303

                                                $box=null;
                                                if(isset($slot->boxes[$idx]))
                                                        $box=$slot->boxes[$idx];
                                                $ret=$slot->removeBox($idx);
                                                if($ret)
                                                {
                                                        $box->delete();
                                                }
                                                return $ret;

$box is set to null, so it’s quite obvious this error could be thrown. $box->delete(); should only be called, if $box is set. I don’t know about the details of this file and code snippet, so I cannot provide a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant