pxt-arcade icon indicating copy to clipboard operation
pxt-arcade copied to clipboard

image.transposed() crashing on device with panic code 821

Open dblloyd opened this issue 1 year ago • 0 comments

image.transposed() has a bug. Here is the code in image.cpp:

Image_ transposed(Image_ img) {
    Image_ r = mkImage(img->height(), img->width(), img->bpp());

    // this is quite slow
    for (int i = 0; i < img->width(); ++i) {
        for (int j = 0; j < img->height(); ++i) {
            setCore(r, j, i, getCore(img, i, j));
        }
    }

    return r;
}

Note that in the inner for loop it should be ++j instead of ++i

This code crashes on a PyBadge.

dblloyd avatar Jan 30 '24 03:01 dblloyd