PC-Logix / OpenSecurity

Security addon for OpenComputers
MIT License
47 stars 24 forks source link

[Bug] Alarm setAlarm method returns true if the sound is invalid #161

Closed GHXX closed 3 years ago

GHXX commented 3 years ago

Describe the bug Calling .setAlarm() while passing a sound name that doesnt exist, makes the function return true

In which environment did the Bug appear? Singleplayer, fresh world.

To Reproduce Steps to reproduce the behavior:

  1. Make a new world
  2. use the /oc_sc command to plop down a opencomputers computer
  3. place an alarm block next to the computer
  4. turn on the pc
  5. open the lua prompt in oc by typing "lua" and hitting enter 6.1. set the variable "a" to be an alarm (a = require("component").os_alarm) 6.2 now execute a.setAlarm("wontwork")
  6. observe that the result is true

Expected behavior The function should throw a error if the sound is invalid. Users can use pcall to catch those errors if necessary. Just making it return false is not a good option in my opinion.

Screenshots / Code Snippet If applicable, add the code you used and screenshots of how your setup looks like image image

Minecraft:

Additional context There are no outputs in the log file while this problem happens.

CaitlynMainer commented 3 years ago

This isn't a bug, as setAlarm always returns true. The server never sees the sounds the client has loaded, so it would have no way of knowing if a sound exists or not.