CCTexture2D crash on cocos2d-x v3

I have experienced a crash that is caused by a return on opengl error in initWithMipmaps method. This crash only happens when cocos’s font atlas is used. The reason is: when early return is used, _name is set but _pixelFormat isn’t set. When Texture2D::updateWithData method is called from font atlas, it passes _name null check but it crashes on at method of std::map because _pixelFormat hasn’t been set and it’s value is PixelFormat::AUTO enum value and a format info doesn’t present for PixelFormat::AUTO in _pixelFormatInfoTables map. I have checked cocos2d-x v4 and this code block had been removed in this version. Should we remove this code block on cocos2d 3.17 if it is safe to remove? I added the code snippet from CCTexture2D. The line numbers are 688-693 on cocos2d-x 3.17.

The code snippet is from initWithMipmaps in CCTexture2D on v3.17:

err = glGetError();
if (err != GL_NO_ERROR)
    CCLOG("cocos2d: Texture2D: Error uploading compressed texture level: %u . glError: 0x%04X", i, err);
    return false;