Skip to content

Commit 5533a7b

Browse files
committed
rgbcolor should not break
1 parent 62325b3 commit 5533a7b

File tree

7 files changed

+29
-26
lines changed

7 files changed

+29
-26
lines changed

dist/jspdf.debug.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
/** @license
77
* jsPDF - PDF Document creation from JavaScript
8-
* Version 1.5.3 Built on 2018-12-25T22:47:22.756Z
9-
* CommitID 7ed161ee98
8+
* Version 1.5.3 Built on 2018-12-26T04:01:24.767Z
9+
* CommitID 62325b3efa
1010
*
1111
* Copyright (c) 2010-2016 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
1212
* 2010 Aaron Spike, https://github.com/acspike
@@ -10207,8 +10207,6 @@
1020710207
style = style.getColor();
1020810208
}
1020910209

10210-
var rgbColor = new RGBColor(style);
10211-
1021210210
if (!style) {
1021310211
return {
1021410212
r: 0,
@@ -10243,7 +10241,9 @@
1024310241
} else {
1024410242
a = 1;
1024510243

10246-
if (style.charAt(0) !== '#') {
10244+
if (typeof style === "string" && style.charAt(0) !== '#') {
10245+
var rgbColor = new RGBColor(style);
10246+
1024710247
if (rgbColor.ok) {
1024810248
style = rgbColor.toHex();
1024910249
} else {
@@ -16686,7 +16686,6 @@
1668616686
Renderer.prototype.getPdfColor = function (style) {
1668716687
var textColor;
1668816688
var r, g, b;
16689-
var rgbColor = new RGBColor(style);
1669016689
var rx = /rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/;
1669116690
var m = rx.exec(style);
1669216691

@@ -16695,7 +16694,9 @@
1669516694
g = parseInt(m[2]);
1669616695
b = parseInt(m[3]);
1669716696
} else {
16698-
if (style.charAt(0) != '#') {
16697+
if (typeof style === "string" && style.charAt(0) != '#') {
16698+
var rgbColor = new RGBColor(style);
16699+
1669916700
if (rgbColor.ok) {
1670016701
style = rgbColor.toHex();
1670116702
} else {
@@ -21278,6 +21279,7 @@
2127821279
(function (global) {
2127921280

2128021281
function RGBColor(color_string) {
21282+
color_string = color_string || '';
2128121283
this.ok = false; // strip any leading #
2128221284

2128321285
if (color_string.charAt(0) == '#') {

dist/jspdf.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.node.debug.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
/** @license
44
* jsPDF - PDF Document creation from JavaScript
5-
* Version 1.5.3 Built on 2018-12-25T22:47:42.414Z
6-
* CommitID 7ed161ee98
5+
* Version 1.5.3 Built on 2018-12-26T04:01:50.595Z
6+
* CommitID 62325b3efa
77
*
88
* Copyright (c) 2010-2016 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
99
* 2010 Aaron Spike, https://github.com/acspike
@@ -9893,8 +9893,6 @@ var jsPDF = function (global) {
98939893
style = style.getColor();
98949894
}
98959895

9896-
var rgbColor = new RGBColor(style);
9897-
98989896
if (!style) {
98999897
return {
99009898
r: 0,
@@ -9929,7 +9927,9 @@ var jsPDF = function (global) {
99299927
} else {
99309928
a = 1;
99319929

9932-
if (style.charAt(0) !== '#') {
9930+
if (typeof style === "string" && style.charAt(0) !== '#') {
9931+
var rgbColor = new RGBColor(style);
9932+
99339933
if (rgbColor.ok) {
99349934
style = rgbColor.toHex();
99359935
} else {
@@ -18101,6 +18101,7 @@ var jsPDF = function (global) {
1810118101
(function (global) {
1810218102

1810318103
function RGBColor(color_string) {
18104+
color_string = color_string || '';
1810418105
this.ok = false; // strip any leading #
1810518106

1810618107
if (color_string.charAt(0) == '#') {

dist/jspdf.node.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/deprecated/from_html.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,6 @@
855855
var textColor;
856856
var r,g,b;
857857

858-
var rgbColor = new RGBColor(style);
859858
var rx = /rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/;
860859
var m = rx.exec(style);
861860
if (m != null){
@@ -864,7 +863,8 @@
864863
b = parseInt(m[3]);
865864
}
866865
else{
867-
if (style.charAt(0) != '#') {
866+
if (typeof style === "string" && style.charAt(0) != '#') {
867+
var rgbColor = new RGBColor(style);
868868
if (rgbColor.ok) {
869869
style = rgbColor.toHex();
870870
} else {

src/libs/rgbcolor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
function RGBColor(color_string)
1212
{
13+
color_string = color_string || '';
1314
this.ok = false;
1415

1516
// strip any leading #

src/modules/context2d.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,6 @@
938938
style = style.getColor();
939939
}
940940

941-
var rgbColor = new RGBColor(style);
942-
943941
if (!style) {
944942
return {r: 0, g: 0, b: 0, a: 0, style: style};
945943
}
@@ -966,7 +964,8 @@
966964
} else {
967965
a = 1;
968966

969-
if (style.charAt(0) !== '#') {
967+
if (typeof style === "string" && style.charAt(0) !== '#') {
968+
var rgbColor = new RGBColor(style);
970969
if (rgbColor.ok) {
971970
style = rgbColor.toHex();
972971
} else {

0 commit comments

Comments
 (0)