diff --git a/assets/gii.js b/assets/gii.js
index <HASH>..<HASH> 100644
--- a/assets/gii.js
+++ b/assets/gii.js
@@ -45,7 +45,14 @@ yii.gii = (function ($) {
             $modal.find('.modal-title').text($link.data('title'));
             $modal.find('.modal-body').html('Loading ...');
             $modal.modal('show');
-            var checked = $('a.' + $modal.data('action') + '[href="' + $link.attr('href') + '"]').closest('tr').find('input').get(0).checked;
+            var checkbox = $('a.' + $modal.data('action') + '[href="' + $link.attr('href') + '"]').closest('tr').find('input').get(0);
+            var checked = false;
+            if (checkbox) {
+                checked = checkbox.checked;
+                $modal.find('.modal-checkbox').removeClass('disabled');
+            } else {
+                $modal.find('.modal-checkbox').addClass('disabled');
+            }
             $modal.find('.modal-checkbox span').toggleClass('glyphicon-check', checked).toggleClass('glyphicon-unchecked', !checked);
             $.ajax({
                 type: 'POST',
fixed breaking Gii preview when file is unchanged

fixes #<I>