summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/heretic/s_sound.c12
-rw-r--r--src/hexen/s_sound.c12
2 files changed, 20 insertions, 4 deletions
diff --git a/src/heretic/s_sound.c b/src/heretic/s_sound.c
index bdd24594..be4ae0e3 100644
--- a/src/heretic/s_sound.c
+++ b/src/heretic/s_sound.c
@@ -550,8 +550,16 @@ void S_GetChannelInfo(SoundInfo_t * s)
c->priority = channel[i].priority;
c->name = S_sfx[c->id].name;
c->mo = channel[i].mo;
- c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
- >> FRACBITS;
+
+ if (c->mo != NULL)
+ {
+ c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
+ >> FRACBITS;
+ }
+ else
+ {
+ c->distance = 0;
+ }
}
}
diff --git a/src/hexen/s_sound.c b/src/hexen/s_sound.c
index fdd01ba5..74774fb3 100644
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -787,8 +787,16 @@ void S_GetChannelInfo(SoundInfo_t * s)
c->priority = Channel[i].priority;
c->name = S_sfx[c->id].name;
c->mo = Channel[i].mo;
- c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
- >> FRACBITS;
+
+ if (c->mo != NULL)
+ {
+ c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
+ >> FRACBITS;
+ }
+ else
+ {
+ c->distance = 0;
+ }
}
}