aboutsummaryrefslogtreecommitdiff
path: root/src/string.zig
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-09-28 03:53:24 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-28 03:53:24 -0700
commit387f1260c9dc0cea667b44ec0152fff0cd4def25 (patch)
tree24dde83cf812481b6d1c8de316a30ece7b745a54 /src/string.zig
parente60b3607c12c91959ec795228cc299703d5b09d0 (diff)
downloadbun-387f1260c9dc0cea667b44ec0152fff0cd4def25.tar.gz
bun-387f1260c9dc0cea667b44ec0152fff0cd4def25.tar.zst
bun-387f1260c9dc0cea667b44ec0152fff0cd4def25.zip
Get Next.js Pages Router to work (#6095)
* hell * make it so bun-debug-src * teag * wild * yippee * fas * fix async hooks assertions * yap * yeah that's wild * aa * a * increase time allowed * so trivial
Diffstat (limited to 'src/string.zig')
-rw-r--r--src/string.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/string.zig b/src/string.zig
index 7928ad97b..1305e5884 100644
--- a/src/string.zig
+++ b/src/string.zig
@@ -855,17 +855,17 @@ pub const SliceWithUnderlyingString = struct {
underlying: String,
pub fn toThreadSafe(this: *SliceWithUnderlyingString) void {
- std.debug.assert(this.underlying.tag == .WTFStringImpl);
-
- var orig = this.underlying.value.WTFStringImpl;
- this.underlying.toThreadSafe();
- if (this.underlying.value.WTFStringImpl != orig) {
- orig.deref();
-
- if (this.utf8.allocator.get()) |allocator| {
- if (String.isWTFAllocator(allocator)) {
- this.utf8.deinit();
- this.utf8 = this.underlying.toUTF8(bun.default_allocator);
+ if (this.underlying.tag == .WTFStringImpl) {
+ var orig = this.underlying.value.WTFStringImpl;
+ this.underlying.toThreadSafe();
+ if (this.underlying.value.WTFStringImpl != orig) {
+ orig.deref();
+
+ if (this.utf8.allocator.get()) |allocator| {
+ if (String.isWTFAllocator(allocator)) {
+ this.utf8.deinit();
+ this.utf8 = this.underlying.toUTF8(bun.default_allocator);
+ }
}
}
}