[TD] App: remove some superfluous nullptr checks
This commit is contained in:
@@ -101,7 +101,7 @@ void DrawProjGroupItem::onChanged(const App::Property *prop)
|
||||
if ((prop == &X) ||
|
||||
(prop == &Y)) {
|
||||
DrawProjGroup* parent = getPGroup();
|
||||
if (parent != nullptr) {
|
||||
if (parent) {
|
||||
parent->touch(false);
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ bool DrawProjGroupItem::showLock(void) const
|
||||
bool result = DrawView::showLock();
|
||||
DrawProjGroup* parent = getPGroup();
|
||||
bool parentLock = false;
|
||||
if (parent != nullptr) {
|
||||
if (parent) {
|
||||
parentLock = parent->LockPosition.getValue();
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void DrawProjGroupItem::autoPosition()
|
||||
}
|
||||
auto pgroup = getPGroup();
|
||||
Base::Vector3d newPos;
|
||||
if (pgroup != nullptr) {
|
||||
if (pgroup) {
|
||||
if (pgroup->AutoDistribute.getValue()) {
|
||||
newPos = pgroup->getXYPosition(Type.getValueAsString());
|
||||
X.setValue(newPos.x);
|
||||
@@ -205,7 +205,7 @@ bool DrawProjGroupItem::isAnchor(void) const
|
||||
{
|
||||
bool result = false;
|
||||
auto group = getPGroup();
|
||||
if (group != nullptr) {
|
||||
if (group) {
|
||||
DrawProjGroupItem* anchor = group->getAnchor();
|
||||
if (anchor == this) {
|
||||
result = true;
|
||||
@@ -253,11 +253,11 @@ Base::Vector3d DrawProjGroupItem::getXDirection(void) const
|
||||
// Base::Console().Message("DPGI::getXDirection() - %s\n", Label.getValue());
|
||||
Base::Vector3d result(1.0, 0.0, 0.0); //default X
|
||||
App::Property* prop = getPropertyByName("XDirection");
|
||||
if (prop != nullptr) {
|
||||
if (prop) {
|
||||
Base::Vector3d propVal = XDirection.getValue();
|
||||
if (DrawUtil::fpCompare(propVal.Length(), 0.0)) { //have XDirection property, but not set
|
||||
prop = getPropertyByName("RotationVector");
|
||||
if (prop != nullptr) {
|
||||
if (prop) {
|
||||
result = RotationVector.getValue(); //use RotationVector if we have it
|
||||
} else {
|
||||
result = DrawViewPart::getXDirection(); //over complex.
|
||||
@@ -268,7 +268,7 @@ Base::Vector3d DrawProjGroupItem::getXDirection(void) const
|
||||
} else { //not sure this branch can actually happen
|
||||
Base::Console().Message("DPGI::getXDirection - unexpected branch taken!\n");
|
||||
prop = getPropertyByName("RotationVector");
|
||||
if (prop != nullptr) {
|
||||
if (prop) {
|
||||
result = RotationVector.getValue();
|
||||
|
||||
} else {
|
||||
@@ -285,7 +285,7 @@ Base::Vector3d DrawProjGroupItem::getLegacyX(const Base::Vector3d& pt,
|
||||
// Base::Console().Message("DPGI::getLegacyX() - %s\n", Label.getValue());
|
||||
Base::Vector3d result(1.0, 0.0, 0.0);
|
||||
App::Property* prop = getPropertyByName("RotationVector");
|
||||
if (prop != nullptr) {
|
||||
if (prop) {
|
||||
result = RotationVector.getValue();
|
||||
if (DrawUtil::fpCompare(result.Length(), 0.0)) { //have RotationVector property, but not set
|
||||
gp_Ax2 va = getViewAxis(pt,
|
||||
@@ -336,7 +336,7 @@ double DrawProjGroupItem::getScale(void) const
|
||||
{
|
||||
double result = 1.0;
|
||||
auto pgroup = getPGroup();
|
||||
if (pgroup != nullptr) {
|
||||
if (pgroup) {
|
||||
result = pgroup->getScale();
|
||||
if (!(result > 0.0)) {
|
||||
Base::Console().Log("DPGI - %s - bad scale found (%.3f) using 1.0\n",getNameInDocument(),Scale.getValue());
|
||||
@@ -348,7 +348,7 @@ double DrawProjGroupItem::getScale(void) const
|
||||
|
||||
void DrawProjGroupItem::unsetupObject()
|
||||
{
|
||||
if (getPGroup() != nullptr) {
|
||||
if (getPGroup()) {
|
||||
if (getPGroup()->hasProjection(Type.getValueAsString()) ) {
|
||||
if ((getPGroup()->getAnchor() == this) &&
|
||||
!getPGroup()->isUnsetting() ) {
|
||||
@@ -365,7 +365,7 @@ void DrawProjGroupItem::unsetupObject()
|
||||
int DrawProjGroupItem::countParentPages() const
|
||||
{
|
||||
DrawProjGroup* dpg = getPGroup();
|
||||
if (dpg != nullptr) {
|
||||
if (dpg) {
|
||||
int count = dpg->countParentPages();
|
||||
return count;
|
||||
}
|
||||
@@ -375,7 +375,7 @@ int DrawProjGroupItem::countParentPages() const
|
||||
DrawPage* DrawProjGroupItem::findParentPage() const
|
||||
{
|
||||
DrawProjGroup* dpg = getPGroup();
|
||||
if (dpg != nullptr) {
|
||||
if (dpg) {
|
||||
DrawPage* dp = dpg->findParentPage();
|
||||
return dp;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ DrawPage* DrawProjGroupItem::findParentPage() const
|
||||
std::vector<DrawPage*> DrawProjGroupItem::findAllParentPages() const
|
||||
{
|
||||
DrawProjGroup* dpg = getPGroup();
|
||||
if (dpg != nullptr) {
|
||||
if (dpg) {
|
||||
std::vector<DrawPage*> dps = dpg->findAllParentPages();
|
||||
return dps;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user