Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix possible nil panic
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Jun 6, 2023
1 parent c598a2e commit 59baa38
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/provider/project_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,11 @@ func (d *projectDataSource) Read(ctx context.Context, req datasource.ReadRequest
default:
// assumes *gen.Job_DataSource_Git
src := project.DataSource.Source.(*gen.Job_DataSource_Git)
pollRaw, _ := time.ParseDuration(project.DataSourcePoll.Interval)
poll := pollRaw / time.Second
var poll int64
if project.DataSourcePoll != nil {
pollRaw, _ := time.ParseDuration(project.DataSourcePoll.Interval)
poll = int64(pollRaw / time.Second)
}
dsg = &dataSourceGitModel{
Url: types.StringValue(src.Git.Url),
Ref: types.StringValue(src.Git.Ref),
Expand Down

0 comments on commit 59baa38

Please sign in to comment.