Fix possible panic

This commit is contained in:
radaiming
2021-04-28 23:23:48 +08:00
parent 0eec95c9db
commit 5dd51ed0f7
2 changed files with 4 additions and 1 deletions

View File

@@ -240,7 +240,7 @@ func parseTime(datestr string, loc *time.Location, opts ...ParserOption) (p *par
// this is because it means that a day is being interpreted as a month and overflowing the valid value for that
// by retrying in this case, we can fix a common situation with no assumptions
defer func() {
if p.ambiguousMD {
if p != nil && p.ambiguousMD {
// if it errors out with the following error, swap before we
// get out of this function to reduce scope it needs to be applied on
_, err := p.parse()