File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ namespace detail {
2626#pragma GCC diagnostic push
2727#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension"
2828static std::string getFinalURL (std::uint32_t id) {
29- auto finalURLChar = static_cast <char *>(EM_ASM_PTR ({
29+ auto finalURLChar = static_cast <char *>(EM_ASM_PTR ({
3030 var fetch = Fetch.xhrs .get ($0 );
3131 if (fetch) {
3232 var finalURL = fetch.responseURL ;
@@ -36,6 +36,9 @@ static std::string getFinalURL(std::uint32_t id) {
3636 return stringOnWasmHeap;
3737 }
3838 return 0 ; }, id));
39+ if (finalURLChar == nullptr ) {
40+ return {};
41+ }
3942 std::string finalURL{ finalURLChar, strlen (finalURLChar) };
4043 EM_ASM ({ _free ($0 ) }, finalURLChar);
4144 return finalURL;
@@ -63,7 +66,7 @@ struct pointer_hash {
6366
6467auto checkedStringViewSize = [](auto numBytes) {
6568 if (numBytes > std::numeric_limits<std::string_view::size_type>::max ()) {
66- throw std::format (" We received more data than we can handle {}" , numBytes);
69+ throw std::out_of_range ( std:: format (" We received more data than we can handle {}" , numBytes) );
6770 }
6871 return static_cast <std::string_view::size_type>(numBytes);
6972};
You can’t perform that action at this time.
0 commit comments