rgb2num crashes dm when provided with non-string literals or datums instantiated as arguments.
Numbered Steps to Reproduce Problem:
Give rgb2num any of the values in the following code under /** crashes **/. Code can be compiled as 'rgb2num_tests.dm' and each line uncommented individually to check.
ed: json_encode is for display, its presence doesn't affect the outcomes.
Code Snippet (if applicable) to Reproduce Problem:
/mob/verb/Test()
/** compiles **/
usr << json_encode( new /datum ) //just showing we can
usr << json_encode(rgb2num( "#fff" )) //
usr << json_encode(rgb2num( "#ffff" )) //
usr << json_encode(rgb2num( "#ffffff" )) //
usr << json_encode(rgb2num( "#ffffffff" )) //
usr << json_encode(rgb2num( "#ffffffff" )) //
//usr << json_encode(rgb2num( "" )) //these compile just fine but
//var/datum/D = new //are disabled to prevent bad
//usr << json_encode(rgb2num( D )) //color runtimes from seeming
//var/N = null //relevant
//usr << json_encode(rgb2num( N )) //
//var/V = 3 //
//usr << json_encode(rgb2num( V )) //
//var/T = /list //
//usr << json_encode(rgb2num( T )) //
//var/F = 'rgb2num_tests.dm' //
//usr << json_encode(rgb2num( F )) //
/** crashes **/
//usr << json_encode(rgb2num( null ))
//usr << json_encode(rgb2num( 3 ))
//usr << json_encode(rgb2num( /list ))
//usr << json_encode(rgb2num( new /datum ))
//usr << json_encode(rgb2num( new /atom )) //for kicks
//usr << json_encode(rgb2num( 'rgb2num_tests.dm' ))
Expected Results:
Should compile but runtime.
Actual Results:
Hangs, then crashes dm.
Does the problem occur:
Every time? Or how often? Yes
In other games? N/A
In other user accounts? N/A
On other computers? Yes
When does the problem NOT occur?
N/A
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Yes - this compiled and runtimed as expected for at least null in 1548. It is probably related to the fixes from http://www.byond.com/forum/post/2660264
Workarounds:
Skip 1549 or keep using legacy user procs for extracting numbers from hex.