Skip to content

Commit 3e3872a

Browse files
authored
Merge pull request #1606 from byquanton/fix/utf8-string-crash
2 parents 2eb8bea + 0085e27 commit 3e3872a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/Util/Util.vala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,9 @@ public class Util : GLib.Object {
367367
public string get_short_name (string name, int size = Constants.SHORT_NAME_SIZE) {
368368
string returned = name;
369369

370-
if (name.length > size) {
371-
returned = name.slice (0, size) + "";
370+
int char_count = name.char_count ();
371+
if (char_count > size) {
372+
returned = name.substring (0, name.index_of_nth_char (size)) + "";
372373
}
373374

374375
return returned;

0 commit comments

Comments
 (0)