fixed copy to clipboard crash when there is nothing to copy
This commit is contained in:
parent
a795759ed2
commit
9f24a35c35
1 changed files with 13 additions and 10 deletions
|
@ -204,20 +204,23 @@ void LogUI::onGUI()
|
|||
}
|
||||
}
|
||||
|
||||
char* mem = (char*)m_allocator.allocate(len);
|
||||
mem[0] = '\0';
|
||||
for (int i = 0; i < messages->size(); ++i)
|
||||
if (len > 0)
|
||||
{
|
||||
const char* msg = (*messages)[i].c_str();
|
||||
if (filter[0] == '\0' || strstr(msg, filter) != nullptr)
|
||||
char* mem = (char*)m_allocator.allocate(len);
|
||||
mem[0] = '\0';
|
||||
for (int i = 0; i < messages->size(); ++i)
|
||||
{
|
||||
Lumix::catString(mem, len, msg);
|
||||
Lumix::catString(mem, len, "\n");
|
||||
const char* msg = (*messages)[i].c_str();
|
||||
if (filter[0] == '\0' || strstr(msg, filter) != nullptr)
|
||||
{
|
||||
Lumix::catString(mem, len, msg);
|
||||
Lumix::catString(mem, len, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlatformInterface::copyToClipboard(mem);
|
||||
m_allocator.deallocate(mem);
|
||||
PlatformInterface::copyToClipboard(mem);
|
||||
m_allocator.deallocate(mem);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::BeginChild("log_messages"))
|
||||
|
|
Loading…
Reference in a new issue