From 59baa38ecb159830fbd193c319fdf0811932046a Mon Sep 17 00:00:00 2001 From: catsby Date: Tue, 6 Jun 2023 13:16:17 -0500 Subject: [PATCH] fix possible nil panic --- internal/provider/project_data_source.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/provider/project_data_source.go b/internal/provider/project_data_source.go index 26a2e90..bbc2492 100644 --- a/internal/provider/project_data_source.go +++ b/internal/provider/project_data_source.go @@ -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),