Skip to content

Commit

Permalink
Check Google logging client pointer for nil before calling Close() (#321
Browse files Browse the repository at this point in the history
)

* check if client pointer is nil before attempting to call Close()

* Resolve panic during shutdown when Google Cloud Output credential file not found

* prepend 'fixed'
  • Loading branch information
Joseph Sirianni authored Jun 1, 2021
1 parent caa243c commit 3114da3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed
- Fixed panic during shutdown when Google Cloud Output credential file not found [Issue 264](https://github.com/observIQ/stanza/issues/264)

## [1.0.0] - 2021-05-27

### Changed
Expand Down
5 changes: 4 additions & 1 deletion operator/builtin/output/googlecloud/google_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ func (g *GoogleCloudOutput) Stop() error {
if err := g.buffer.Close(); err != nil {
return err
}
return g.client.Close()
if g.client != nil {
return g.client.Close()
}
return nil
}

// Process processes an entry
Expand Down

0 comments on commit 3114da3

Please sign in to comment.