Don't throw JS error when AJAX license selection is on but there's no license selecto...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 8 Feb 2011 11:12:26 +0000 (11:12 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 8 Feb 2011 11:12:26 +0000 (11:12 +0000)
skins/common/upload.js

index c91482b..4185ec9 100644 (file)
@@ -59,12 +59,12 @@ window.wgUploadSetup = function() {
                row.appendChild( td );
        }
        
-       if ( wgAjaxLicensePreview ) {
+       var wpLicense = document.getElementById( 'wpLicense' );
+       if ( wgAjaxLicensePreview && wpLicense ) {
                // License selector check
-               document.getElementById( 'wpLicense' ).onchange = licenseSelectorCheck;
+               wpLicense.onchange = licenseSelectorCheck;
        
                // License selector table row
-               var wpLicense = document.getElementById( 'wpLicense' );
                var wpLicenseRow = wpLicense.parentNode.parentNode;
                var wpLicenseTbody = wpLicenseRow.parentNode;