mw.Title: Handle empty this.title
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.Title.js
index e46eca5..661ab74 100644 (file)
                 * @return {string}
                 */
                getName: function () {
-                       if ( $.inArray( this.namespace, mw.config.get( 'wgCaseSensitiveNamespaces' ) ) !== -1 ) {
+                       if (
+                               $.inArray( this.namespace, mw.config.get( 'wgCaseSensitiveNamespaces' ) ) !== -1 ||
+                               !this.title.length
+                       ) {
                                return this.title;
                        }
                        return this.title[0].toUpperCase() + this.title.slice( 1 );