Skip to content

Commit

Permalink
Fix crash if player has no melee weapon
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Mar 10, 2024
1 parent 795003f commit a352ed8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cdogs/actors.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
This file incorporates work covered by the following copyright and
permission notice:
Copyright (c) 2013-2023 Cong Xu
Copyright (c) 2013-2024 Cong Xu
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -1872,6 +1872,10 @@ struct vec2 ActorGetMuzzleOffset(
int ActorWeaponGetAmmo(
const TActor *a, const WeaponClass *wc, const int barrel)
{
if (wc == NULL)
{
return 0;
}
const int ammoId = WC_BARREL_ATTR(*wc, AmmoId, barrel);
if (ammoId == -1)
{
Expand Down

0 comments on commit a352ed8

Please sign in to comment.