diff --git a/CHANGELOG.md b/CHANGELOG.md index c552929906..e4af4ab080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,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 0c182a1db9..8d0ecb32e8 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -457,6 +457,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);