diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf3c82d0b..3e6801e83a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### 🐞 Bug fixes - Fix zooming outside the central globe when terrain 3D is enabled ([#3425](https://github.com/maplibre/maplibre-gl-js/pull/3425)) +- Handle loading of empty raster tiles (204 No Content) ([#3428](https://github.com/maplibre/maplibre-gl-js/pull/3428)) - _...Add new stuff here..._ ## 4.0.0-pre.1 diff --git a/src/util/util.ts b/src/util/util.ts index 6f597d4399..c9fd1bc6e8 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -461,6 +461,9 @@ export function isImageBitmap(image: any): image is ImageBitmap { * @returns - A promise resolved when the conversion is finished */ export const arrayBufferToImageBitmap = async (data: ArrayBuffer): Promise => { + if (data.byteLength === 0) { + return createImageBitmap(new ImageData(1, 1)); + } const blob: Blob = new Blob([new Uint8Array(data)], {type: 'image/png'}); try { return createImageBitmap(blob);