XML Registry: empty file `reg.xml` - Access Violation in `TRegistry.Create`

Summary

Running application with empty reg.xml (zero length file) leads to AV in TRegistry.Create.

Steps to reproduce

  1. Create empty file reg.xml (or truncate existing) - it must be an actual 'registry path' (such as ~/.config/vendor_name/app_name/)
  2. Create simple application with:
...
var
  reg: TRegistry;
begin
  reg:= TRegistry.Create;
...

Patch

fpc_xmlreg.diff

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information