Skip to content

Commit 4016c99

Browse files
authored
Fix dividing by zero error
1 parent 6ae618b commit 4016c99

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

LazySchoolboyUtil/Util.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ public static class Util
1414
public static void GenerateFile(string path, int size, Format format)
1515
{
1616
progress = 0;
17+
1718
byte[] bytesToBeSaved = new byte[size];
1819

1920
rand.GetBytes(bytesToBeSaved);
2021

2122
for (int i = format.GetOffset(); i <= format.GetOffset() + format.GetMagicNumbers().Length - 1; i++)
2223
{
23-
progress = i / (format.GetMagicNumbers().LongLength / 100);
24+
progress = (double)i / ((double)format.GetMagicNumbers().Length / (double)100);
2425
bytesToBeSaved[i] = format.GetMagicNumbers()[i - format.GetOffset()];
2526
}
2627

0 commit comments

Comments
 (0)