fix the *actual* crash

This commit is contained in:
Maxicarlos08 2024-01-26 02:15:14 +01:00
parent f759fd5059
commit 47a909e94d
No known key found for this signature in database

View File

@ -672,10 +672,12 @@ impl Block {
#[must_use]
pub fn from_u32(x: u32) -> Option<Self> {
let [bk, r, g, b] = x.to_le_bytes();
Some(Self {
let block = Self {
kind: BlockKind::from_u8(bk)?,
data: [r, g, b],
})
};
(block.kind.is_filled() || SpriteKind::from_block(block).is_some()).then_some(block)
}
#[inline]