problem with association

if i put @messages[0].sender.name

i receive an error: You have a nil object when you didn't expect it! The error occurred while evaluating nil.name

Well the obvious reason is that you have a message with a nil
message.sender. Is this the case ?

Fred