mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
restorable: Add more detailed information to the panic message
Updates #1427
This commit is contained in:
parent
d4a2433643
commit
410766c984
@ -30,7 +30,11 @@ type rectToPixels struct {
|
|||||||
|
|
||||||
func (rtp *rectToPixels) addOrReplace(pixels []byte, x, y, width, height int) {
|
func (rtp *rectToPixels) addOrReplace(pixels []byte, x, y, width, height int) {
|
||||||
if len(pixels) != 4*width*height {
|
if len(pixels) != 4*width*height {
|
||||||
panic(fmt.Sprintf("restorable: len(pixels) must be %d but %d", 4*width*height, len(pixels)))
|
msg := fmt.Sprintf("restorable: len(pixels) must be 4*%d*%d = %d but %d", width, height, 4*width*height, len(pixels))
|
||||||
|
if pixels == nil {
|
||||||
|
msg += " (nil)"
|
||||||
|
}
|
||||||
|
panic(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rtp.m == nil {
|
if rtp.m == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user