Avoid crash when weight is NULL

review1171003
issue3433