aboutsummaryrefslogtreecommitdiff
path: root/src/string.zig
diff options
context:
space:
mode:
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);
+ }
}
}
}