Possible bug on 4.1.3 with Matek H743-MINI - SD card related

Today I was doing the optical flow setup as per the guide:
https://ardupilot.org/copter/docs/common-optical-flow-sensor-setup.html#common-optical-flow-sensor-setup

I had LOG_DISARMED = 1 and occasionally plugged in and unplugged the battery to calmly read the logs.
At some point ARDUCOPTER STARTED RESTARTING without being able to connect it to Mission Planner anymore because it restarted immediately after the connection.

At first I thought it was a problem with some parameters, so I was forced to reset all the parameters by installing a “plane” version.
Everything was ok then, but when I tried to download the logs here it rebooted again!
Pay attention LOG_DISARMED was back to 0. And I have not armed the drone.

So I took the SD and inserted it into the PC.
The drive letter could be seen but I was unable to browse folders.
The SD was broken.

If I put the SD in the drone and try to arm it … as soon as it wants to write, arducopter restarts.

So I thought that this can be a problem if by chance an SD fails while in flight.

Has anyone ever had this problem?

Raffaello