mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
DIRECTOR: LINGO: Correctly process empty strings in b_numberofwords()
This commit is contained in:
parent
aee1577792
commit
0b755ee54d
@ -2043,6 +2043,14 @@ void LB::b_numberofwords(int nargs) {
|
||||
d.makeString();
|
||||
int numberofwords = 0;
|
||||
Common::String contents = *d.u.s;
|
||||
if (contents.empty()) {
|
||||
d.u.i = 0;
|
||||
d.type = INT;
|
||||
|
||||
g_lingo->push(d);
|
||||
|
||||
return;
|
||||
}
|
||||
for (uint32 i = 1; i < d.u.s->size(); i++) {
|
||||
if (Common::isSpace(contents[i]) && !Common::isSpace(contents[i - 1]))
|
||||
numberofwords++;
|
||||
|
Loading…
Reference in New Issue
Block a user