@@ -142,15 +142,18 @@ Item {
142142
143143 implicitSize: Sizes .itemWidth - Appearance .padding .normal * 2
144144 source: {
145- if (item .modelData .isImage )
146- return Qt .resolvedUrl (item .modelData .path );
145+ const file = item .modelData ;
146+ if (! file)
147+ return Quickshell .iconPath (" application-x-zerosize" );
147148
148- if (! item . modelData . isDir )
149- return Quickshell . iconPath ( item . modelData . mimeType . replace ( " / " , " - " ), " application-x-zerosize " );
149+ if (file . isImage )
150+ return Qt . resolvedUrl ( file . path );
150151
151- const name = item .modelData .name ;
152- if (root .dialog .cwd .length === 1 && [" Desktop" , " Documents" , " Downloads" , " Music" , " Pictures" , " Public" , " Templates" , " Videos" ].includes (name))
153- return Quickshell .iconPath (` folder-${ name .toLowerCase ()} ` );
152+ if (! file .isDir )
153+ return Quickshell .iconPath (file .mimeType .replace (" /" , " -" ), " application-x-zerosize" );
154+
155+ if (root .dialog .cwd .length === 1 && [" Desktop" , " Documents" , " Downloads" , " Music" , " Pictures" , " Public" , " Templates" , " Videos" ].includes (file .name ))
156+ return Quickshell .iconPath (` folder-${ file .name .toLowerCase ()} ` );
154157
155158 return Quickshell .iconPath (" inode-directory" );
156159 }
@@ -166,7 +169,7 @@ Item {
166169 anchors .margins : Appearance .padding .normal
167170
168171 horizontalAlignment: Text .AlignHCenter
169- text: item .modelData .name
172+ text: item .modelData ? .name ?? " "
170173 elide: item .GridView .isCurrentItem ? Text .ElideNone : Text .ElideRight
171174 wrapMode: item .GridView .isCurrentItem ? Text .WrapAtWordBoundaryOrAnywhere : Text .NoWrap
172175 }
0 commit comments