Fix crash when appending items of empty vector to wxItemContainer
Passing an empty std::vector<wxString> to Append() or Insert() methods of any wxItemContainer-derived classes, such as e.g. wxComboBox, resulted in undefined behaviour due to accessing the first element of an empty vector. Fix this by avoiding using it when the vector is empty.
This commit is contained in:
parent
32db375e46
commit
17c7048f36
1 changed files with 1 additions and 1 deletions
|
|
@ -494,7 +494,7 @@ public:
|
|||
wxArrayStringsAdapter(const std::vector<wxString>& strings)
|
||||
: m_type(wxSTRING_POINTER), m_size(strings.size())
|
||||
{
|
||||
m_data.ptr = &strings[0];
|
||||
m_data.ptr = m_size == 0 ? NULL : &strings[0];
|
||||
}
|
||||
#endif // wxUSE_STD_CONTAINERS_COMPATIBLY
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue