Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General check for null pointer in saveGraph #503

Merged
merged 1 commit into from
Sep 1, 2020
Merged

Conversation

varunagrawal
Copy link
Collaborator

Fix for #467

@varunagrawal varunagrawal added the bugfix Fixes an issue or bug label Aug 31, 2020
@varunagrawal varunagrawal self-assigned this Aug 31, 2020
@varunagrawal varunagrawal linked an issue Aug 31, 2020 that may be closed by this pull request
if(formatting.connectKeysToFactor && factor) {
for(Key key: *factor) {
stm << " var" << key << "--" << "factor" << i << ";\n";
if (formatting.connectKeysToFactor && factor) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just formatting.

}
}
}
}
else {
if(factor) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this check since I added a generic check at the beginning.

if(pos != formatting.factorPositions.end())
stm << ", pos=\"" << formatting.scale*(pos->second.x() - minX) << ","
<< formatting.scale*(pos->second.y() - minY) << "!\"";
map<size_t, Point2>::const_iterator pos =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting changes.

const KeyVector& keys = factor->keys();
if (formatting.binaryEdges && keys.size()==2) {
stm << " var" << keys[0] << "--" << "var" << keys[1] << ";\n";
if (formatting.binaryEdges && keys.size() == 2) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting changes

if (!factor) {
continue;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is the main fix.

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-)

@varunagrawal varunagrawal merged commit 199ac63 into develop Sep 1, 2020
@varunagrawal varunagrawal deleted the fix/nfg-check branch September 1, 2020 01:55
@tmoerwald
Copy link

Thanks for fixing that, and sorry for not doing it myself. I was on holidays the last two weeks.

@dellaert
Copy link
Member

dellaert commented Sep 1, 2020

Sure! I hope you had a nice holiday!

@varunagrawal
Copy link
Collaborator Author

Sure thing! Thanks for bringing up this issue and hope you had a nice holiday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes an issue or bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null-pointer access in NonlinearFactorGraph::saveGraph()
3 participants