File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,9 @@ function addGlyphNamesAll(font) {
252252 const c = charCodes [ i ] ;
253253 const glyphIndex = glyphIndexMap [ c ] ;
254254 glyph = font . glyphs . get ( glyphIndex ) ;
255- glyph . addUnicode ( parseInt ( c ) ) ;
255+ if ( glyph ) {
256+ glyph . addUnicode ( parseInt ( c ) ) ;
257+ }
256258 }
257259
258260 for ( let i = 0 ; i < font . glyphs . length ; i += 1 ) {
Original file line number Diff line number Diff line change 11// The GlyphSet object
22
33import Glyph from './glyph.js' ;
4+ import { logger } from './logger.js' ;
45
56// Define a property on the glyph that depends on the path being loaded.
67function defineDependentProperty ( glyph , externalName , internalName ) {
@@ -63,7 +64,12 @@ if(typeof Symbol !== 'undefined' && Symbol.iterator) {
6364GlyphSet . prototype . get = function ( index ) {
6465 // this.glyphs[index] is 'undefined' when low memory mode is on. glyph is pushed on request only.
6566 if ( this . glyphs [ index ] === undefined ) {
66- if ( typeof this . font . _push !== 'function' ) return ;
67+ if ( typeof this . font . _push !== 'function' ) {
68+ if ( index !== null ) {
69+ logger . add ( `Trying to access unknown glyph at index ${ index } ` , logger . ErrorTypes . WARNING ) ;
70+ }
71+ return ;
72+ }
6773
6874 this . font . _push ( index ) ;
6975 if ( typeof this . glyphs [ index ] === 'function' ) {
You can’t perform that action at this time.
0 commit comments