dispaly name of author in blog tutorial

[i][b]Trying to get property of non-object

D:\wamp\www\blog yii\demo\protected\views\post\_view.php(34)[/b][/i]




22     <br />

23 

24     <b><?php echo CHtml::encode($data->getAttributeLabel('create_time')); ?>:</b>

25     <?php echo CHtml::encode($data->create_time); ?>

26     <br />

27 

28     <b><?php echo CHtml::encode($data->getAttributeLabel('update_time')); ?>:</b>

29     <?php echo CHtml::encode($data->update_time); ?>

30     <br />

31 

32 

33     <b><?php echo CHtml::encode($data->getAttributeLabel('author_id')); ?>:</b>

34     <?php echo $data->author->username; ?>

35     <br />

36 

37 

38 

39 </div>

its working now error occur just because one of the row have empty ‘author_id’