Skip to content

Commit 0fd2b9a

Browse files
Add null check to fileio demo 4
1 parent afbfddb commit 0fd2b9a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed
Binary file not shown.

CEdev/examples/library_examples/fileio/demo_4/src/main.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ void main(void) {
2727
int in;
2828

2929
/* Get the answer variable */
30-
if(ti_RclVar(TI_REAL_TYPE, ti_Ans, &real_in))
31-
return;
32-
33-
if((in = os_RealToInt24(real_in)) < 1)
34-
return;
30+
if(ti_RclVar(TI_REAL_TYPE, ti_Ans, &real_in)) return;
31+
if((in = os_RealToInt24(real_in)) < 1) return;
3532

3633
prime_factors((unsigned)in);
34+
35+
if(!total_primes) return;
3736
list_out = ti_MallocList(total_primes);
3837

3938
for(i=0; i<total_primes; i++) {

0 commit comments

Comments
 (0)