@@ -999,7 +999,7 @@ pub const TextField = struct {
999999
10001000 pub fn getText (self : * TextField ) [:0 ]const u8 {
10011001 const len = win32 .GetWindowTextLengthW (self .peer );
1002- var buf = lib .internal .allocator .allocSentinel (u16 , @as (usize , @intCast (len )), 0 ) catch unreachable ; // TODO return error
1002+ var buf = lib .internal .allocator .allocSentinel (u16 , @as (usize , @intCast (len )), 0 ) catch @panic ( "OOM" );
10031003 defer lib .internal .allocator .free (buf );
10041004 const realLen = @as (usize , @intCast (win32 .GetWindowTextW (self .peer , buf .ptr , len + 1 )));
10051005 const utf16Slice = buf [0.. realLen ];
@@ -1060,11 +1060,11 @@ pub const TextArea = struct {
10601060 pub fn getText (self : * TextArea ) [:0 ]const u8 {
10611061 const allocator = self .arena .allocator ();
10621062 const len = win32 .GetWindowTextLengthW (self .peer );
1063- var buf = allocator .allocSentinel (u16 , @as (usize , @intCast (len )), 0 ) catch unreachable ; // TODO return error
1063+ var buf = allocator .allocSentinel (u16 , @as (usize , @intCast (len )), 0 ) catch @panic ( "OOM" );
10641064 defer allocator .free (buf );
10651065 const realLen = @as (usize , @intCast (win32 .GetWindowTextW (self .peer , buf .ptr , len + 1 )));
10661066 const utf16Slice = buf [0.. realLen ];
1067- const text = std .unicode .utf16LeToUtf8AllocZ (allocator , utf16Slice ) catch unreachable ; // TODO return error
1067+ const text = std .unicode .utf16LeToUtf8AllocZ (allocator , utf16Slice ) catch @panic ( "OOM" );
10681068 return text ;
10691069 }
10701070
@@ -1122,11 +1122,11 @@ pub const Button = struct {
11221122 pub fn getLabel (self : * Button ) [:0 ]const u8 {
11231123 const allocator = self .arena .allocator ();
11241124 const len = win32 .GetWindowTextLengthW (self .peer );
1125- var buf = allocator .allocSentinel (u16 , @as (usize , @intCast (len )), 0 ) catch unreachable ; // TODO return error
1125+ var buf = allocator .allocSentinel (u16 , @as (usize , @intCast (len )), 0 ) catch @panic ( "OOM" );
11261126 defer allocator .free (buf );
11271127 const realLen = @as (usize , @intCast (win32 .GetWindowTextW (self .peer , buf .ptr , len + 1 )));
11281128 const utf16Slice = buf [0.. realLen ];
1129- const text = std .unicode .utf16leToUtf8AllocZ (allocator , utf16Slice ) catch unreachable ; // TODO return error
1129+ const text = std .unicode .utf16leToUtf8AllocZ (allocator , utf16Slice ) catch @panic ( "OOM" );
11301130 return text ;
11311131 }
11321132
@@ -1415,7 +1415,7 @@ pub const TabContainer = struct {
14151415 pub fn insert (self : * TabContainer , position : usize , peer : PeerType ) usize {
14161416 const item = win32Backend.TCITEMA { .mask = 0 };
14171417 const newIndex = win32Backend .TabCtrl_InsertItemW (self .tabControl , @as (c_int , @intCast (position )), & item );
1418- self .peerList .append (peer ) catch unreachable ;
1418+ self .peerList .append (peer ) catch @panic ( "OOM" ) ;
14191419
14201420 if (self .shownPeer == null ) {
14211421 _ = win32 .SetParent (peer , self .peer );
0 commit comments