-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Fixed ErrorException: Attempt to read property "asset_tag" on null (rollbar #3541) #13547
Fixed ErrorException: Attempt to read property "asset_tag" on null (rollbar #3541) #13547
Conversation
app/View/Label.php
Outdated
@@ -39,6 +39,10 @@ public function render(callable $callback = null) | |||
$assets = $this->data->get('assets'); | |||
$offset = $this->data->get('offset'); | |||
$template = $this->data->get('template'); | |||
|
|||
if ($assets->isEmpty()){ | |||
return redirect()->back(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be doing a ->with('error', 'Blah blah blah no valid assets')
here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about that, but if I added that error message the page looks kinda cluttered as there's already an error message showing that the asset doesn't exist.
PR Summary
|
I noticed the "old" label engine just displays an empty page (on develop) instead of redirecting back. Should we consolidate the behavior between the two engines? |
With this changes the old label engine is also redirected if the asset is deleted. I did saw that text, but I thought it had something to do with my local environment, something like not using a 'proper' server. But gonna investigate that |
Ah... |
Nice! I was already on the BulkAssets controller, just figuring out how to handle it there... |
@inietov Is this ready to go yet? |
I think that now is ready. Sorry |
Thanks! |
Description
When trying to generate a label on a deleted asset the system returns a 500 error. I'll put an early return if no assets are found, so the user returns to the asset view with the warning that says the asset is currently deleted.
Fixes rollbar RB-3541
Type of change
How Has This Been Tested?
Test Configuration: