Skip to content

Commit d085951

Browse files
authored
Merge pull request #1400 from asarium/fix/fredInvalidIndex
Fix invalid indexing in object orientation editor
2 parents c3f1963 + bf2ca61 commit d085951

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fred2/orienteditor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ void orient_editor::update_object(object *ptr)
215215
loc.xyz.y = convert(m_location_y);
216216
loc.xyz.z = convert(m_location_z);
217217
if (((CButton *) GetDlgItem(IDC_POINT_TO_OBJECT))->GetCheck() == 1) {
218-
v = Objects[index[m_object_index]].pos;
219-
vm_vec_sub2(&v, &ptr->pos);
220-
218+
if (m_object_index >= 0) {
219+
v = Objects[index[m_object_index]].pos;
220+
vm_vec_sub2(&v, &ptr->pos);
221+
}
221222
} else if (((CButton *) GetDlgItem(IDC_POINT_TO_LOCATION))->GetCheck() == 1) {
222223
vm_vec_sub(&v, &loc, &ptr->pos);
223224

0 commit comments

Comments
 (0)