Update component.go

Add check for NaN values and Inf values