Skip to content

Commit

Permalink
fix: ensure information about blocked services pause schedule exists …
Browse files Browse the repository at this point in the history
…in state before attempting to use it (#86)
  • Loading branch information
gmichels authored Dec 19, 2023
1 parent 48a140d commit 5c5684a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adguard/client_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (o *clientCommonModel) Read(ctx context.Context, adg adguard.ADG, currState
// need special handling for timezone in resource due to inconsistent API response for `Local`
if rtype == "resource" {
// last updated will exist on create operation, null on import operation
if !currState.LastUpdated.IsNull() {
if !currState.LastUpdated.IsNull() && !currState.BlockedServicesPauseSchedule.IsNull() {
// unpack current state
var currStateBlockedServicesPauseScheduleClient scheduleModel
*diags = currState.BlockedServicesPauseSchedule.As(ctx, &currStateBlockedServicesPauseScheduleClient, basetypes.ObjectAsOptions{})
Expand Down
2 changes: 1 addition & 1 deletion adguard/config_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ func (o *configCommonModel) Read(ctx context.Context, adg adguard.ADG, currState
stateBlockedServicesPauseScheduleConfig := mapAdgScheduleToBlockedServicesPauseSchedule(ctx, &blockedServicesPauseSchedule.Schedule)

// need special handling for timezone in resource due to inconsistent API response for `Local`
if rtype == "resource" {
if rtype == "resource" && !currState.BlockedServicesPauseSchedule.IsNull() {
// last updated will exist on create operation, null on import operation
if !currState.LastUpdated.IsNull() {
// unpack current state
Expand Down

0 comments on commit 5c5684a

Please sign in to comment.