unsigned long sot_pos, post_sod_pos;\r
unsigned long int left_THmarks_len, epbs_len = 0;\r
int startpack = 0, stoppack = j2k->image_info->num;\r
- jpwl_epb_ms_t *tph_epb;\r
+ jpwl_epb_ms_t *tph_epb = NULL;\r
\r
sot_pos = j2k->image_info->tile[tileno].start_pos;\r
cio_seek(cio, sot_pos + 2); \r
}\r
\r
/* we can now check if the TPH EPB was really the last one */\r
- if (epb_index == 1) {\r
+ if (tph_epb && (epb_index == 1)) {\r
/* set the TPH EPB to be the last one in current header */\r
tph_epb->Depb |= (unsigned char) ((true & 0x0001) << 6);\r
-\r
+ tph_epb = NULL;\r
}\r
\r
/* write back Psot */\r
\r
/*@}*/\r
\r
-#endif /* USE_JPWL */
\ No newline at end of file
+#endif /* USE_JPWL */\r