Skip to content

Commit

Permalink
Remove redundant try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
whitebyte authored and GrimMaple committed Nov 26, 2024
1 parent a22f2aa commit 986c1fc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/dlangui/core/collections.d
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,11 @@ struct ObjectList(T) {
return _list[index];
}
/// get item by index. Returns null if item not found
inout(T) tryGet(int index) @safe inout nothrow {
try {
if (index < 0 || index >= _count) {
return null;
}
return _list[index];
} catch (Exception e) {
inout(T) tryGet(int index) @safe inout {
if (index < 0 || index >= _count) {
return null;
}
return _list[index];
}
/// get item by index
T opIndex(int index) @safe {
Expand Down

0 comments on commit 986c1fc

Please sign in to comment.