adobe-flash / crossbridge

Welcome to visit the homepage!
http://www.crossbridge.io
542 stars 194 forks source link

PlayerKernel.open() throws exception when opening ISpecialFile file with O_TRUNC #61

Open testpoiu opened 8 years ago

testpoiu commented 8 years ago

O_TRUNC will make fileentry.bytes.length = 0, but this throws a null pointer exception when fileentry.bytes is not set (which can be the case for ISpecialFile entries). Easily fixed:

if ( fileentry.bytes ) fileentry.bytes.length = 0

A real fix might call on ISpecialFile, which would require a new method such as truncate().