projects
/
FET_sim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eab4df5
)
Patch seg fault when simulating FET with NULL on gate
author
Lukáš Jiřiště
<gymnazium.jiriste@gmail.com>
Fri, 16 Feb 2024 21:58:23 +0000
(22:58 +0100)
committer
Lukáš Jiřiště
<gymnazium.jiriste@gmail.com>
Fri, 16 Feb 2024 21:58:23 +0000
(22:58 +0100)
FETs with no connection on gate now default to closed.
src/sim_main.c
patch
|
blob
|
history
diff --git
a/src/sim_main.c
b/src/sim_main.c
index 14cc9b56b48229b098aa9aa9ad70d7c9177199d0..37929e6b13d76f0d224056e6653155ca829f2303 100644
(file)
--- a/
src/sim_main.c
+++ b/
src/sim_main.c
@@
-1,10
+1,16
@@
#include "FET_sim.h"
#include "libft.h"
+// Maybe an error should be return when gate is NULL
static void update_mosfet(t_mosfet *mosfet)
{
t_state state;
+ if (!mosfet->gate)
+ {
+ mosfet->is_opened = 0;
+ return ;
+ }
state = mosfet->gate->state;
if (mosfet->type == p && state == on)
mosfet->is_opened = 1;