Add validation for empty jQuery objects in icon handling

- Check .length === 0 to prevent TypeError on .attr('class')
- Prevents issues when empty jQuery object is passed (e.g., $('.nonexistent'))
This commit is contained in:
mgutt
2025-10-26 17:45:52 +01:00
parent 46b3d5d951
commit 737a515151

View File

@@ -70,8 +70,8 @@ function dfm_footer(action, text, $icon) {
// Add icon and text
if ($icon && text) {
// Ensure $icon is a jQuery object
if (!($icon instanceof jQuery)) {
// Ensure $icon is a jQuery object with elements
if (!($icon instanceof jQuery) || $icon.length === 0) {
$notice.html(fileManagerIcon + text);
break;
}
@@ -180,7 +180,7 @@ function dfm_showProgress(data) {
$dialogContainer.contents().filter(function() {
return this.nodeType === 3; // Text nodes only
}).remove();
// Remove <br> elements
$dialogContainer.find('br').remove();