Skip to content

Commit abdbe7d

Browse files
authored
fix:abbrName is empty (#2244)
1 parent 0c572f3 commit abdbe7d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/dict/dictionary.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ bool Class::loadIconFromFilePath( QString const & filename )
291291

292292
bool Class::loadIconFromText( const QString & iconUrl, QString const & text )
293293
{
294-
if ( text.isEmpty() ) {
294+
//select a single char.
295+
auto abbrName = getAbbrName( text );
296+
if ( abbrName.isEmpty() ) {
295297
return false;
296298
}
297299
QImage img( iconUrl );
@@ -313,9 +315,6 @@ bool Class::loadIconFromText( const QString & iconUrl, QString const & text )
313315

314316
const QRect rectangle = QRect( 0, 0, iconSize, iconSize );
315317

316-
//select a single char.
317-
auto abbrName = getAbbrName( text );
318-
319318
painter.setPen( intToFixedColor( qHash( abbrName ) ) );
320319

321320
// Draw first character

0 commit comments

Comments
 (0)