Skip to content

Commit

Permalink
fix: validate surface color array length
Browse files Browse the repository at this point in the history
  • Loading branch information
zackarydev authored and mojoaxel committed Dec 19, 2019
1 parent 1b616af commit 2cfedbb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/graph3d/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ function setSurfaceColor(surfaceColors, dst) {
let rgbColors = [];

if(Array.isArray(surfaceColors)) {
if(surfaceColors.length < 2) {
throw new Error('Surface colors array length must be 2 or above.');
}
rgbColors = surfaceColors.map(function(colorCode){
if(!util.isValidHex(colorCode)) {
throw new Error('Invalid hex color code supplied to surfaceColors.');
Expand Down

0 comments on commit 2cfedbb

Please sign in to comment.