FirstGearGames / FishNet

FishNet: Unity Networking Evolved.
Other
1.24k stars 138 forks source link

Nullable DespawnType? can both be not null and have no value #708

Closed dwal02 closed 1 day ago

dwal02 commented 2 weeks ago

Important

If General, Description, and Replication are not completed the issue will be closed immediately.

General Unity version: 2022.3.14f1 Fish-Networking version: Unsure. Directly pulled from GitHub. 4.3.5R ? Discord link: ** Above, post a link from our Discord where you troubleshot the issue (on Discord click the three dots next to the message, then Copy Message Link). Issue may be closed out if this is not included.

Description A clear and concise description of what the bug is.

When calling Despawn, a missing despawnType parameter somewhere along the chain causes despawnType to both be not equal to null and have no value, causing a crash inside ServerManager.Despawn(NetworkObject, DespawnType).

Replication Steps to reproduce the behavior:

Call Despawn(networkObject) on a non-server-owned object within a ServerRPC within a NetworkBehaviour, without the despawnType parameter.

Expected behavior

This is easily resolvable by replacing resolvedDespawnType = (despawnType == null) on line 147 of ServerManager.QOL.cs with resolvedDespawnType = (despawnType == null || !despawnType.HasValue) or resolvedDespawnType = (!despawnType.HasValue)

Screenshots

DespawnTypeBug

FirstGearGames commented 2 weeks ago

Wondering if that's a Unity bug. The compiler is supposed to replace null check with HasValue.

Making the change to only check HasValue should suffice either way.

On Tue, Jul 2, 2024, 1:05 AM dwal02 @.***> wrote:

Important

If General, Description, and Replication are not completed the issue will be closed immediately.

General Unity version: 2022.3.14f1 Fish-Networking version: Unsure. Directly pulled from GitHub. 4.3.5R ? Discord link: ** Above, post a link from our Discord where you troubleshot the issue (on Discord click the three dots next to the message, then Copy Message Link). Issue may be closed out if this is not included.

Description A clear and concise description of what the bug is.

When calling Despawn, a missing despawnType parameter somewhere along the chain causes despawnType to both be not equal to null and have no value, causing a crash inside ServerManager.Despawn(NetworkObject, DespawnType).

Replication Steps to reproduce the behavior:

Call Despawn(networkObject) within a ServerRPC within a NetworkBehaviour (without the despawnType parameter)

Expected behavior

This is easily resolvable by replacing resolvedDespawnType = (despawnType == null) on line 147 of ServerManager.QOL.cs with resolvedDespawnType = (despawnType == null || !despawnType.HasValue) or resolvedDespawnType = (!despawnType.HasValue)

Screenshots

DespawnTypeBug.png (view on web) https://github.com/FirstGearGames/FishNet/assets/18695173/2edd3879-26b4-4a52-b99f-2c8d901d8893

— Reply to this email directly, view it on GitHub https://github.com/FirstGearGames/FishNet/issues/708, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGPJC3XFQC5CEBQRPXFIMBTZKIYJ7AVCNFSM6AAAAABKGYK4YOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM4DKMRTG4ZTSNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

FirstGearGames commented 2 weeks ago

Definitely a Unity bug. I'll get it resolved in 4.3.8.

dwal02 commented 2 weeks ago

Cheers !


From: FirstGearGames @.> Sent: Friday, July 5, 2024 11:53:50 PM To: FirstGearGames/FishNet @.> Cc: dwal02 @.>; Author @.> Subject: Re: [FirstGearGames/FishNet] Nullable DespawnType? can both be not null and have no value (Issue #708)

Definitely a Unity bug. I'll get it resolved in 4.3.8.

— Reply to this email directly, view it on GitHubhttps://github.com/FirstGearGames/FishNet/issues/708#issuecomment-2210920544, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEOUIBNTMHPE3ZS43IIZLODZK2QO5AVCNFSM6AAAAABKGYK4YOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJQHEZDANJUGQ. You are receiving this because you authored the thread.Message ID: @.***>