Add nil check for scraped measurements (#6367)

This commit is contained in:
WithoutPants 2025-12-04 07:27:47 +11:00 committed by GitHub
parent e02ef436a5
commit ee61fc879b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -125,8 +125,8 @@ func translateGender(gender *graphql.GenderEnum) *string {
return nil return nil
} }
func formatMeasurements(m graphql.MeasurementsFragment) *string { func formatMeasurements(m *graphql.MeasurementsFragment) *string {
if m.BandSize != nil && m.CupSize != nil && m.Hip != nil && m.Waist != nil { if m != nil && m.BandSize != nil && m.CupSize != nil && m.Hip != nil && m.Waist != nil {
ret := fmt.Sprintf("%d%s-%d-%d", *m.BandSize, *m.CupSize, *m.Waist, *m.Hip) ret := fmt.Sprintf("%d%s-%d-%d", *m.BandSize, *m.CupSize, *m.Waist, *m.Hip)
return &ret return &ret
} }
@ -209,7 +209,7 @@ func performerFragmentToScrapedPerformer(p graphql.PerformerFragment) *models.Sc
Name: &p.Name, Name: &p.Name,
Disambiguation: p.Disambiguation, Disambiguation: p.Disambiguation,
Country: p.Country, Country: p.Country,
Measurements: formatMeasurements(*p.Measurements), Measurements: formatMeasurements(p.Measurements),
CareerLength: formatCareerLength(p.CareerStartYear, p.CareerEndYear), CareerLength: formatCareerLength(p.CareerStartYear, p.CareerEndYear),
Tattoos: formatBodyModifications(p.Tattoos), Tattoos: formatBodyModifications(p.Tattoos),
Piercings: formatBodyModifications(p.Piercings), Piercings: formatBodyModifications(p.Piercings),