diff options
author | 2011-08-05 22:37:18 +0000 | |
---|---|---|
committer | 2011-08-05 22:37:18 +0000 | |
commit | 2f9462d29fe4c66660251734c64d16628326f8e5 (patch) | |
tree | 5724e33325351990a23800cd1630665aefe4a22e /src/views | |
parent | e55f533f4c80818d542c2beac14a37600c3718f8 (diff) |
Fixed error in SkOSMenu
git-svn-id: http://skia.googlecode.com/svn/trunk@2056 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/SkOSMenu.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp index 8137365d00..ce3894aeb4 100644 --- a/src/views/SkOSMenu.cpp +++ b/src/views/SkOSMenu.cpp @@ -189,14 +189,15 @@ bool SkOSMenu::FindListItemCount(const SkEvent* evt, int* count) { bool SkOSMenu::FindListItems(const SkEvent* evt, SkString items[]) { if (evt->isType(gMenuEventType) && NULL != items) { const char* text = evt->findString(gList_Items_Str); - char temp[strlen(text)]; - memcpy(temp, text, strlen(text) + 1); //make sure to copy the null terminator - char* token = strtok(temp, gDelimiter); - int index = 0; - while (token != NULL) { - items[index].set(token, strlen(token)); - token = strtok (NULL, gDelimiter); - ++index; + if (text != NULL) { + SkString temp(text); + char* token = strtok((char*)temp.c_str(), gDelimiter); + int index = 0; + while (token != NULL) { + items[index].set(token, strlen(token)); + token = strtok (NULL, gDelimiter); + ++index; + } } return true; } |