Skip to content

Commit b7f747d

Browse files
v-einhoffstadt
authored andcommitted
fix: make sure new API functions return null on an exception #2097
1 parent 1d33ed8 commit b7f747d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/dearpygui_commands.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ set_axis_limits_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
10321032
auto tag = "set_axis_limits_constraints";
10331033

10341034
if (!Parse((GetParsers())[tag], args, kwargs, __FUNCTION__, &axisraw, &vmin, &vmax))
1035-
return GetPyNone();
1035+
return nullptr;
10361036

10371037
mvPySafeLockGuard lk(GContext->mutex);
10381038

@@ -1043,14 +1043,14 @@ set_axis_limits_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
10431043
{
10441044
mvThrowPythonError(mvErrorCode::mvItemNotFound, tag,
10451045
"Item not found: " + std::to_string(axis), nullptr);
1046-
return GetPyNone();
1046+
return nullptr;
10471047
}
10481048

10491049
if (aplot->type != mvAppItemType::mvPlotAxis)
10501050
{
10511051
mvThrowPythonError(mvErrorCode::mvIncompatibleType, tag,
10521052
"Incompatible type. Expected types include: mvPlotAxis", aplot);
1053-
return GetPyNone();
1053+
return nullptr;
10541054
}
10551055

10561056
mvPlotAxis* graph = static_cast<mvPlotAxis*>(aplot);
@@ -1066,7 +1066,7 @@ reset_axis_limits_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
10661066
auto tag = "reset_axis_limits_constraints";
10671067

10681068
if (!Parse((GetParsers())[tag], args, kwargs, __FUNCTION__, &axisraw))
1069-
return GetPyNone();
1069+
return nullptr;
10701070

10711071
mvPySafeLockGuard lk(GContext->mutex);
10721072

@@ -1077,14 +1077,14 @@ reset_axis_limits_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
10771077
{
10781078
mvThrowPythonError(mvErrorCode::mvItemNotFound, tag,
10791079
"Item not found: " + std::to_string(axis), nullptr);
1080-
return GetPyNone();
1080+
return nullptr;
10811081
}
10821082

10831083
if (aplot->type != mvAppItemType::mvPlotAxis)
10841084
{
10851085
mvThrowPythonError(mvErrorCode::mvIncompatibleType, tag,
10861086
"Incompatible type. Expected types include: mvPlotAxis", aplot);
1087-
return GetPyNone();
1087+
return nullptr;
10881088
}
10891089

10901090
mvPlotAxis* graph = static_cast<mvPlotAxis*>(aplot);
@@ -1101,7 +1101,7 @@ set_axis_zoom_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
11011101
auto tag = "set_axis_zoom_constraints";
11021102

11031103
if (!Parse((GetParsers())[tag], args, kwargs, __FUNCTION__, &axisraw, &vmin, &vmax))
1104-
return GetPyNone();
1104+
return nullptr;
11051105

11061106
mvPySafeLockGuard lk(GContext->mutex);
11071107

@@ -1112,14 +1112,14 @@ set_axis_zoom_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
11121112
{
11131113
mvThrowPythonError(mvErrorCode::mvItemNotFound, tag,
11141114
"Item not found: " + std::to_string(axis), nullptr);
1115-
return GetPyNone();
1115+
return nullptr;
11161116
}
11171117

11181118
if (aplot->type != mvAppItemType::mvPlotAxis)
11191119
{
11201120
mvThrowPythonError(mvErrorCode::mvIncompatibleType, tag,
11211121
"Incompatible type. Expected types include: mvPlotAxis", aplot);
1122-
return GetPyNone();
1122+
return nullptr;
11231123
}
11241124

11251125
mvPlotAxis* graph = static_cast<mvPlotAxis*>(aplot);
@@ -1136,7 +1136,7 @@ reset_axis_zoom_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
11361136
auto tag = "reset_axis_zoom_constraints";
11371137

11381138
if (!Parse((GetParsers())[tag], args, kwargs, __FUNCTION__, &axisraw))
1139-
return GetPyNone();
1139+
return nullptr;
11401140

11411141
mvPySafeLockGuard lk(GContext->mutex);
11421142

@@ -1147,14 +1147,14 @@ reset_axis_zoom_constraints(PyObject* self, PyObject* args, PyObject* kwargs)
11471147
{
11481148
mvThrowPythonError(mvErrorCode::mvItemNotFound, tag,
11491149
"Item not found: " + std::to_string(axis), nullptr);
1150-
return GetPyNone();
1150+
return nullptr;
11511151
}
11521152

11531153
if (aplot->type != mvAppItemType::mvPlotAxis)
11541154
{
11551155
mvThrowPythonError(mvErrorCode::mvIncompatibleType, tag,
11561156
"Incompatible type. Expected types include: mvPlotAxis", aplot);
1157-
return GetPyNone();
1157+
return nullptr;
11581158
}
11591159

11601160
mvPlotAxis* graph = static_cast<mvPlotAxis*>(aplot);

0 commit comments

Comments
 (0)