summaryrefslogtreecommitdiff
path: root/std/vec.zc
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-27 10:43:05 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-27 10:43:05 +0000
commitd97c1c14b7f62fffc1ce54d4ff3354a5ee21743f (patch)
tree1adf0e6be133132685ba81a251f94a6e3dad379a /std/vec.zc
parent270eea5e23e3aeaa93aa0b483cba76cfee1f0df9 (diff)
Fix segfault caused in 'dfs.zc'
Diffstat (limited to 'std/vec.zc')
-rw-r--r--std/vec.zc8
1 files changed, 8 insertions, 0 deletions
diff --git a/std/vec.zc b/std/vec.zc
index 16f23a7..59142d7 100644
--- a/std/vec.zc
+++ b/std/vec.zc
@@ -190,6 +190,14 @@ impl Vec<T> {
return self.data[idx];
}
+ fn get_ref(self, idx: usize) -> T* {
+ if (idx >= self.len) {
+ !"Panic: Index out of bounds";
+ exit(1);
+ }
+ return &self.data[idx];
+ }
+
fn last(self) -> T {
if (self.len == 0) {
!"Panic: last called on empty Vec";