Fixed a NPE in decoding the RGB values (#62)
* Fixed a NPE in decoding the RGB values * Fix the formatting
This commit is contained in:
parent
0dbda4ba80
commit
ca3e18f031
1 changed files with 8 additions and 4 deletions
|
@ -57,7 +57,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function rgb_to_array(str) {
|
function rgb_to_array(str) {
|
||||||
m = str.match(/^#([0-9a-f]{6})$/i)[1];
|
matches = str.match(/^#([0-9a-f]{6})$/i)
|
||||||
|
if (!matches) {
|
||||||
|
return [0,0,0]
|
||||||
|
}
|
||||||
|
m = matches[1];
|
||||||
if(m) {
|
if(m) {
|
||||||
return [
|
return [
|
||||||
parseInt(m.substr(0,2),16),
|
parseInt(m.substr(0,2),16),
|
||||||
|
|
Loading…
Reference in a new issue