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

Prevent Player:CanUseFlashlight() from returning nil #1296

Merged
merged 1 commit into from Jan 16, 2017

Conversation

Projects
None yet
2 participants
@LeQuackers
Contributor

LeQuackers commented Dec 14, 2016

Because Player.m_bFlashlight is nil by default, it will cause unwanted behavior in certain cases:

-- this will be false if Player:AllowFlashlight was not called
if ( ply:CanUseFlashlight() == false ) then PlaySpookySound() end

-- this works fine
if ( ply:CanUseFlashlight() != true ) then PlaySpookySound() end
Prevent Player:CanUseFlashlight from returning nil
Because Player.m_bFlashlight is nil by default, it will cause unwanted behavior in certain cases:
```Lua
if ( ply:CanUseFlashlight() == false ) then PlaySpookySound() end -- this will fail if Player:AllowFlashlight was not called before this
if ( ply:CanUseFlashlight() != true ) then PlaySpookySound() end -- works fine
```

@robotboy655 robotboy655 merged commit 42d3200 into Facepunch:master Jan 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment