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) {
252
252
const c = charCodes [ i ] ;
253
253
const glyphIndex = glyphIndexMap [ c ] ;
254
254
glyph = font . glyphs . get ( glyphIndex ) ;
255
- glyph . addUnicode ( parseInt ( c ) ) ;
255
+ if ( glyph ) {
256
+ glyph . addUnicode ( parseInt ( c ) ) ;
257
+ }
256
258
}
257
259
258
260
for ( let i = 0 ; i < font . glyphs . length ; i += 1 ) {
Original file line number Diff line number Diff line change 1
1
// The GlyphSet object
2
2
3
3
import Glyph from './glyph.js' ;
4
+ import { logger } from './logger.js' ;
4
5
5
6
// Define a property on the glyph that depends on the path being loaded.
6
7
function defineDependentProperty ( glyph , externalName , internalName ) {
@@ -63,7 +64,12 @@ if(typeof Symbol !== 'undefined' && Symbol.iterator) {
63
64
GlyphSet . prototype . get = function ( index ) {
64
65
// this.glyphs[index] is 'undefined' when low memory mode is on. glyph is pushed on request only.
65
66
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
+ }
67
73
68
74
this . font . _push ( index ) ;
69
75
if ( typeof this . glyphs [ index ] === 'function' ) {
You can’t perform that action at this time.
0 commit comments