Fix analyser warning because prevAttr or newAttr could be nil