Fixed a crash when remove a view linked tables.

Minor fix on view's reference code generation.