File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ var CharacterMap = function (_React$Component) {
188
188
* that character from secondary and replace the least used character
189
189
* from primary with it.
190
190
*/
191
- if ( this . secondaryPaletteCache [ 0 ] . count > this . paletteCache [ paletteMaxSize - 1 ] . count ) {
191
+ if ( this . paletteCache [ paletteMaxSize - 1 ] && this . secondaryPaletteCache [ 0 ] . count > this . paletteCache [ paletteMaxSize - 1 ] . count ) {
192
192
var maxCountCharInSecondaryPalette = this . secondaryPaletteCache . shift ( ) ;
193
193
this . paletteCache [ paletteMaxSize - 1 ] = maxCountCharInSecondaryPalette ;
194
194
this . paletteCache . sort ( function ( a , b ) {
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ class CharacterMap extends React.Component {
129
129
* that character from secondary and replace the least used character
130
130
* from primary with it.
131
131
*/
132
- if ( this . secondaryPaletteCache [ 0 ] . count > this . paletteCache [ paletteMaxSize - 1 ] . count ) {
132
+ if ( this . paletteCache [ paletteMaxSize - 1 ] && this . secondaryPaletteCache [ 0 ] . count > this . paletteCache [ paletteMaxSize - 1 ] . count ) {
133
133
const maxCountCharInSecondaryPalette = this . secondaryPaletteCache . shift ( ) ;
134
134
this . paletteCache [ paletteMaxSize - 1 ] = maxCountCharInSecondaryPalette ;
135
135
this . paletteCache . sort ( ( a , b ) => b . count - a . count ) ;
You can’t perform that action at this time.
0 commit comments