Update hap.c to match reference repo
The small change to argument checking doesn't affect this implementation