diff --git a/core/misc/form.js b/core/misc/form.js index 0e51d833f9..3256a17fd8 100644 --- a/core/misc/form.js +++ b/core/misc/form.js @@ -31,7 +31,14 @@ */ $.fn.drupalGetSummary = function () { const callback = this.data('summaryCallback'); - return this[0] && callback ? callback(this[0]).trim() : ''; + + if (!this[0] || !callback) { + return ''; + } + + const result = callback(this[0]); + + return result ? result.trim() : ''; }; /**