I seems that recalc_default_resources was a culprit - sometimes it set the resource to 255 (INVALID_RESOURCE), while allowed is only existing resource or kNoResource. I created a branch with proposed fix
I seems that recalc_ default_ resources was a culprit - sometimes it set the resource to 255 (INVALID_RESOURCE), while allowed is only existing resource or kNoResource. I created a branch with proposed fix