ch1rh0 - 2015-06-25

Yii application log indicated that the error came from _bugChange.php

2015/06/25 14:46:09 [error] [php] Trying to get property of non-object (C:\Apache\htdocs\crashfix\protected\views\site_bugChange.php:11)

The error occurred while PHP trying to access "username" field from $model->user.

    by <?php echo CHtml::encode($model->user->username) ?>

It turns out that the user who created the bug was deleted, which caused $model->user to be NULL. Not sure if similar issue can pop out somewhere else. For this particular one, I'm proposing the following fix:

    by
    <?php
        if (is_null($model->user)) {
            echo "Deleted User (ID: $model->user_id)";
        }
        else {
            echo CHtml::encode($model->user->username);
        }
    ?>