Skip to content

Commit

Permalink
Fix startup crash
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzei committed Apr 10, 2023
1 parent 6846df0 commit 207e612
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions server/plugin/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"reflect"
"strings"

pluginapi "github.com/mattermost/mattermost-plugin-api"
"github.com/mattermost/mattermost-plugin-api/experimental/telemetry"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/pkg/errors"
Expand Down Expand Up @@ -190,6 +191,10 @@ func (p *Plugin) setConfiguration(configuration *Configuration) {

// OnConfigurationChange is invoked when configuration changes may have been made.
func (p *Plugin) OnConfigurationChange() error {
if p.client == nil {
p.client = pluginapi.NewClient(p.API, p.Driver)
}

var configuration = new(Configuration)

// Load the public configuration fields from the Mattermost server configuration.
Expand Down
4 changes: 3 additions & 1 deletion server/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ func (p *Plugin) setDefaultConfiguration() error {
}

func (p *Plugin) OnActivate() error {
p.client = pluginapi.NewClient(p.API, p.Driver)
if p.client == nil {
p.client = pluginapi.NewClient(p.API, p.Driver)
}

siteURL := p.client.Configuration.GetConfig().ServiceSettings.SiteURL
if siteURL == nil || *siteURL == "" {
Expand Down

0 comments on commit 207e612

Please sign in to comment.