Fix crash with recent refactor of customdata writing.

Caused by own rBff3d535bc2a6309 - since we now only write the exact amount of layers
needed to store saved customdata, we have to adjust CustomData->maxlayer too.

Otherwise, on next read, customdata code believes it has more layers allocated than
actual number.

Issue reported by Campbell over IRC, thanks.
This commit is contained in:
Bastien Montagne 2015-07-22 11:54:53 +02:00
parent cf6002737d
commit 945f32e66d

@ -3251,6 +3251,7 @@ void CustomData_file_write_prepare(
}
}
BLI_assert(j == data->totlayer);
data->maxlayer = data->totlayer; /* We only write that much of data! */
*r_write_layers = write_layers;
}