Having an assignment in a conditional is confusing.  This would be better written as two lines.