Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential nil value in self.PlayerData.source in SetMetaData function #554

Closed
Adazdef opened this issue Aug 26, 2024 · 0 comments
Closed
Labels
bug Something isn't working need repro This bug report needs confirmation

Comments

@Adazdef
Copy link

Adazdef commented Aug 26, 2024

Summary

In the SetMetaData function, the self.PlayerData.source can potentially be nil.

Reproduction

  1. Using this code:
    local player = exports.qbx_core:GetPlayerByCitizenId(identifier) or exports.qbx_core:GetOfflinePlayer(identifier)
    if not player then return false end
    
    player.Functions.SetMetaData('test_meta', url)
    return true
  2. Observe the error in the server console.
  3. The error message observed is:
    [     script:qbx_core] SCRIPT ERROR: Native invocation failed.
    [     script:qbx_core] > ref (@qbx_core/server/player.lua:701)
    

Expected behavior

The function should check if self.PlayerData.source is not nil before attempting to trigger events or update the player's state.

Actual behavior

The function attempted to trigger events and update player states without checking if self.PlayerData.source was nil.

Additional context

No response

Current Version

1.17.2

Custom Resources

@Adazdef Adazdef added bug Something isn't working need repro This bug report needs confirmation labels Aug 26, 2024
@qbox-duck qbox-duck bot added this to Issues Aug 26, 2024
@github-project-automation github-project-automation bot moved this to Todo in Issues Aug 26, 2024
@Qbox-project Qbox-project deleted a comment Aug 26, 2024
@github-staff github-staff deleted a comment from Lxx-c Oct 23, 2024
@github-staff github-staff deleted a comment from Lxx-c Oct 23, 2024
@Manason Manason closed this as completed Dec 12, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro This bug report needs confirmation
Projects
Status: Done
Development

No branches or pull requests

2 participants