• Robin Cheng's avatar
    Fix an unnecessary racy access in SingleWriterFixedHashMap on empty iterator · bfde457b
    Robin Cheng authored
    Summary:
    When grabbing an iterator when the map is empty, size is zero but we
    still create a copy of the elem_ pointer which is invalid to do when the size
    is zero (since the writer could overwrite the pointer upon first insertion).
    This diff checks whether the iterator would be empty and if so avoid grabbing
    that pointer.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D23520616
    
    fbshipit-source-id: 5b3f2bc3a9b935920e7fd616e64fadafd7775a75
    bfde457b
SingleWriterFixedHashMap.h 8.37 KB