Skip to content

Commit

Permalink
Fix V command exception
Browse files Browse the repository at this point in the history
Thanks ItsRodrigoAl!
  • Loading branch information
SDGNelson committed Jul 3, 2024
1 parent 859c6a2 commit 183c523
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes should be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## 4.9.3.17 - 2024-07-03

### Fixed
- V command expecting `VehicleAsset` throwing an exception when encountering `VehicleRedirectorAsset`. Thanks @ItsRodrigoAl in issue #75.

## 4.9.3.16 - 2023-10-13

### Changed
Expand Down
6 changes: 3 additions & 3 deletions Rocket.Unturned/Commands/CommandV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public void Execute(IRocketPlayer caller, string[] command)
}

Asset[] assets = SDG.Unturned.Assets.find(EAssetType.VEHICLE);
foreach (VehicleAsset ia in assets)
foreach (Asset ia in assets)
{
if (ia != null && ia.vehicleName != null && ia.vehicleName.ToLower().Contains(itemString.ToLower()))
if (ia != null && ia.FriendlyName != null && ia.FriendlyName.ToLower().Contains(itemString.ToLower()))
{
id = ia.id;
break;
Expand All @@ -82,7 +82,7 @@ public void Execute(IRocketPlayer caller, string[] command)
}

Asset a = SDG.Unturned.Assets.find(EAssetType.VEHICLE, id.Value);
string assetName = ((VehicleAsset)a).vehicleName;
string assetName = a.FriendlyName; // Nelson 2024-07-03: Didn't previously check for null either.

if(U.Settings.Instance.EnableVehicleBlacklist && !player.HasPermission("vehicleblacklist.bypass"))
{
Expand Down
2 changes: 1 addition & 1 deletion Rocket.Unturned/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
[assembly: AssemblyProduct("Rocket.Unturned")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: Guid("8870d132-f877-4fbd-9e73-49c8b1af8b3f")]
[assembly: AssemblyVersion("4.9.3.16")]
[assembly: AssemblyVersion("4.9.3.17")]

0 comments on commit 183c523

Please sign in to comment.