diff options
Diffstat (limited to 'core/string_db.h')
-rw-r--r-- | core/string_db.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/core/string_db.h b/core/string_db.h index de91e2abd8..5e3086d4ec 100644 --- a/core/string_db.h +++ b/core/string_db.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -138,7 +138,22 @@ public: _FORCE_INLINE_ bool operator()(const StringName &l, const StringName &r) const { - return l.operator String() < r.operator String(); + const char *l_cname = l._data ? l._data->cname : ""; + const char *r_cname = r._data ? r._data->cname : ""; + + if (l_cname) { + + if (r_cname) + return is_str_less(l_cname, r_cname); + else + return is_str_less(l_cname, r._data->name.ptr()); + } else { + + if (r_cname) + return is_str_less(l._data->name.ptr(), r_cname); + else + return is_str_less(l._data->name.ptr(), r._data->name.ptr()); + } } }; |