FAT editing: fix creating files that are multiple of cluster size

Closes #568
This commit is contained in:
Floris Bos 2023-03-22 16:42:10 +01:00
parent 493869e47a
commit 65f6a07fae
2 changed files with 8 additions and 1 deletions

View file

@ -320,7 +320,7 @@ void DeviceWrapperFatPartition::writeFile(const QString &filename, const QByteAr
break;
}
if (clustersNeeded)
if (clustersNeeded && contents.length() % _bytesPerCluster)
{
/* Zero out last cluster tip */
uint32_t extraBytesAtEndOfCluster = _bytesPerCluster - (contents.length() % _bytesPerCluster);