Don't crash when building segment bridge in editor the wrong way

Check if there is Markedsegp and replacing an Assert with a LevelError.
This commit is contained in:
Chris Taylor 2016-11-12 16:41:54 +08:00
parent ac52a30214
commit 4568bbae11
2 changed files with 7 additions and 1 deletions

View file

@ -35,6 +35,11 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
// ---------- Create a bridge segment between current segment/side and marked segment/side ----------
int CreateBridge()
{
if (!Markedsegp) {
editor_status("No marked side.");
return 0;
}
if (!med_form_bridge_segment(Cursegp,Curside,Markedsegp,Markedside)) {
Update_flags |= UF_WORLD_CHANGED;
mine_changed = 1;

View file

@ -1277,7 +1277,8 @@ static void get_verts_for_normal(int va, int vb, int vc, int vd, int *v0, int *v
swap(w[j], w[i]);
}
Assert((v[0] < v[1]) && (v[1] < v[2]) && (v[2] < v[3]));
if (!((v[0] < v[1]) && (v[1] < v[2]) && (v[2] < v[3])))
LevelError("Level contains malformed geometry.");
// Now, if for any w[i] & w[i+1]: w[i+1] = (w[i]+3)%4, then must swap
*v0 = v[0];