Skip to content

Commit

Permalink
fix: custom series delete crash issue #1864
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Oct 22, 2022
1 parent 6630615 commit 3361292
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/dearpygui_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -2999,7 +2999,8 @@ delete_item(PyObject* self, PyObject* args, PyObject* kwargs)

mvUUID item = GetIDFromPyObject(itemraw);

DeleteItem((*GContext->itemRegistry), item, childrenOnly, slot);
if(item != 0)
DeleteItem((*GContext->itemRegistry), item, childrenOnly, slot);

return GetPyNone();

Expand Down
22 changes: 15 additions & 7 deletions src/mvPythonTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,11 @@ ToPyList(const std::vector<double>& value)

PyObject* result = PyList_New(value.size());

for (size_t i = 0; i < value.size(); ++i)
PyList_SetItem(result, i, PyFloat_FromDouble(value[i]));

if(result)
{
for (size_t i = 0; i < value.size(); ++i)
PyList_SetItem(result, i, PyFloat_FromDouble(value[i]));
}
return result;
}

Expand All @@ -284,8 +286,11 @@ ToPyList(const std::vector<std::vector<float>>& value)
{
PyObject* result = PyList_New(value.size());

for (size_t i = 0; i < value.size(); ++i)
PyList_SetItem(result, i, ToPyList(value[i]));
if(result)
{
for (size_t i = 0; i < value.size(); ++i)
PyList_SetItem(result, i, ToPyList(value[i]));
}

return result;
}
Expand All @@ -295,8 +300,11 @@ ToPyList(const std::vector<std::vector<double>>& value)
{
PyObject* result = PyList_New(value.size());

for (size_t i = 0; i < value.size(); ++i)
PyList_SetItem(result, i, ToPyList(value[i]));
if(result)
{
for (size_t i = 0; i < value.size(); ++i)
PyList_SetItem(result, i, ToPyList(value[i]));
}

return result;
}
Expand Down

0 comments on commit 3361292

Please sign in to comment.