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

Fix plugin_active check when plugin is not found #13531

Merged
merged 3 commits into from Nov 17, 2021

Conversation

murrant
Copy link
Member

@murrant murrant commented Nov 17, 2021

Error when loading hook App\Plugins\ExamplePlugin\Settings of type App\Plugins\Hooks\SettingsHook for ExamplePlugin: Attempt to read property "plugin_active" on null

Please note

Please read this information carefully. You can run ./lnms dev:check to check your code before submitting.

  • Have you followed our code guidelines?
  • If my Pull Request does some changes/fixes/enhancements in the WebUI, I have inserted a screenshot of it.
  • If my Pull Request makes discovery/polling/yaml changes, I have added/updated test data.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926
After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

@@ -167,7 +167,7 @@ public function pluginExists(string $pluginName): bool
*/
public function pluginEnabled(string $pluginName): bool
{
return $this->getPlugin($pluginName)->plugin_active;
return (bool) optional($this->getPlugin($pluginName))->plugin_active;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looksie who loves optional :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does a thing, just not the best thing.

@Jellyfrog Jellyfrog merged commit 562af58 into librenms:master Nov 17, 2021
@murrant murrant deleted the plugin-active-error branch November 17, 2021 21:52
@librenms-bot
Copy link

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/21-12-0-changelog/17740/1

NightowlKr pushed a commit to NightowlKr/librenms that referenced this pull request Dec 30, 2021
* Fix plugin_active check when plugin is not found

* update baseline

* revert incorrect commit
NightowlKr pushed a commit to NightowlKr/librenms that referenced this pull request Dec 31, 2021
* Fix plugin_active check when plugin is not found

* update baseline

* revert incorrect commit
NightowlKr pushed a commit to NightowlKr/librenms that referenced this pull request Dec 31, 2021
* Fix plugin_active check when plugin is not found

* update baseline

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

Successfully merging this pull request may close these issues.

None yet

3 participants