This patch is a quick attempt to fix the crashes caused by mismatch between materials count in objects and obdata, due to placeholders generation for missing libdata.
This is a rather brute-force approach, but at least it is simple and quiet reliable I think.
Note that we cannot do that when generating the obdata placeholder, as not all objects using it might be already loaded... So this has to be done near the end of the reading/linking process anyway. We could add a new tag for obdata that would need that processing, but don't think it would be worth it?