aboutsummaryrefslogtreecommitdiff
path: root/backend/String.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/String.cpp')
-rw-r--r--backend/String.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/backend/String.cpp b/backend/String.cpp
index 84dc2ec..8be6892 100644
--- a/backend/String.cpp
+++ b/backend/String.cpp
@@ -95,7 +95,9 @@ bool String::empty() const {
bool operator == (const String & a, const String & b) {
- return strncmp(a._data, b._data, min(a._data_len, b._data_len)) == 0;
+ if (a._data_len != b._data_len) return false;
+ if (a._data_len == 0) return true;
+ return strncmp(a._data, b._data, a._data_len) == 0;
}
bool operator != (const String & a, const String & b) {