diff --git a/spine-c/spine-c/src/spine/Atlas.c b/spine-c/spine-c/src/spine/Atlas.c index b83838a94..ea8b596bb 100644 --- a/spine-c/spine-c/src/spine/Atlas.c +++ b/spine-c/spine-c/src/spine/Atlas.c @@ -139,7 +139,10 @@ typedef struct SimpleString { static SimpleString *ss_trim(SimpleString *self) { while (isspace((unsigned char) *self->start) && self->start < self->end) self->start++; - if (self->start == self->end) return self; + if (self->start == self->end) { + self->length = self->end - self->start; + return self; + } self->end--; while (((unsigned char) *self->end == '\r') && self->end >= self->start) self->end--; diff --git a/spine-cpp/spine-cpp/src/spine/Atlas.cpp b/spine-cpp/spine-cpp/src/spine/Atlas.cpp index 6033ecb57..19a7cedf9 100644 --- a/spine-cpp/spine-cpp/src/spine/Atlas.cpp +++ b/spine-cpp/spine-cpp/src/spine/Atlas.cpp @@ -111,7 +111,10 @@ struct SimpleString { SimpleString trim() { while (isspace((unsigned char) *start) && start < end) start++; - if (start == end) return *this; + if (start == end) { + length = end - start; + return *this; + } end--; while (((unsigned char) *end == '\r') && end >= start) end--;