Skip to content
  • Lioncash's avatar
    common/file_util: Make GetCurrentDir() return a std::optional · 11e9bee9
    Lioncash authored
    nullptr was being returned in the error case, which, at a glance may
    seem perfectly OK... until you realize that std::string has the
    invariant that it may not be constructed from a null pointer. This
    means that if this error case was ever hit, then the application would
    most likely crash from a thrown exception in std::string's constructor.
    
    Instead, we can change the function to return an optional value,
    indicating if a failure occurred.
    11e9bee9
Loading