Skip to content

Commit

Permalink
FIXED potential access to iterators that point to the end of a list
Browse files Browse the repository at this point in the history
  • Loading branch information
ksterker committed Aug 4, 2010
1 parent ed41a92 commit 05072ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/dlgedit/dlg_module.cc
Expand Up @@ -224,6 +224,9 @@ void DlgModule::deleteNode (DlgNode *node)
// if the node is a circle, also delete the attached arrows
if (node->type () != LINK)
{
// reset traversal info if current node gets deleted
traverse_.clear();

// delete all preceding arrows
for (DlgNode *i = node->prev (FIRST); i != NULL; i = node->prev (FIRST))
{
Expand Down
2 changes: 1 addition & 1 deletion src/dlgedit/dlg_node.cc
Expand Up @@ -83,7 +83,7 @@ DlgNode* DlgNode::getNode (std::list<DlgNode*>::iterator &it,
}

// forward iteration
if (offset > 0)
if (offset >= 0)
{
for (int i = 0; i < offset && it != lst.end (); i++, it++);
if (it != lst.end ()) return *it;
Expand Down
2 changes: 1 addition & 1 deletion src/dlgedit/gui_graph.cc
Expand Up @@ -201,7 +201,7 @@ bool GuiGraph::newArrow (DlgPoint &point)
if (end == NULL) return false;
}

// no loops and no bidirectional connections
// no loops and no duplicate connections
if (start == end || ((DlgCircle *) start)->hasChild (end)) return false;

// no connection between start and end if both are PLAYER nodes
Expand Down

0 comments on commit 05072ed

Please sign in to comment.