diff options
-rw-r--r-- | lld/COFF/Librarian.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lld/COFF/Librarian.cpp b/lld/COFF/Librarian.cpp index 4c597fad734..493fd6a2f6a 100644 --- a/lld/COFF/Librarian.cpp +++ b/lld/COFF/Librarian.cpp @@ -104,7 +104,10 @@ static ImportNameType getNameType(StringRef Sym, StringRef ExtName) { static std::string replace(StringRef S, StringRef From, StringRef To) { size_t Pos = S.find(From); - assert(Pos != StringRef::npos); + if (Pos == StringRef::npos) { + error(S + ": replacing '" + From + "' with '" + To + "' failed"); + return ""; + } return (Twine(S.substr(0, Pos)) + To + S.substr(Pos + From.size())).str(); } |