Skip to content

Commit

Permalink
skip empty sentence
Browse files Browse the repository at this point in the history
  • Loading branch information
Artikash committed Jan 30, 2019
1 parent 3f5a07d commit 4647a78
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ExampleExtension/ExtensionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extern "C" __declspec(dllexport) wchar_t* OnNewSentence(wchar_t* sentence, const
int origLength = sentenceStr.size();
if (ProcessSentence(sentenceStr, SentenceInfo{ miscInfo }))
{
if (sentenceStr.empty()) return nullptr;
// No need to worry about freeing this: Textractor does it for you.
wchar_t* newSentence = sentenceStr.size() > origLength ? (wchar_t*)HeapAlloc(GetProcessHeap(), 0, (sentenceStr.size() + 1) * sizeof(wchar_t)) : sentence;
wcscpy_s(newSentence, sentenceStr.size() + 1, sentenceStr.c_str());
Expand Down

0 comments on commit 4647a78

Please sign in to comment.