Saturnus: I suspect you are right about it being a bug.
I had a play using your code and get the same results.

Use this replacement main to see the error a little more clearly.
It looks to me like the "ptr_for_handle" function is buggy...
Code:
void main()
{
	level_load(NULL);
	
	int i;
	for (i = 0; i < 20; i++)
	{
		TEXT* my_txt = txt_create(1,10);
		var my_handle = handle(my_txt);
		TEXT* my_txt1 = ptr_for_handle(my_handle);
		
		if (!my_txt1)
		{
			printf("NULL pointer ( TEXT*: %i | handle: %i | hbyte: %i | ptr_for_handle: %i )",
				(long)my_txt, my_handle, my_handle >> 14, (long)my_txt1);
		}
		else
		{
			printf("Pointer OK ( TEXT*: %i | handle: %i | hbyte: %i | ptr_for_handle: %i )",
				(long)my_txt, my_handle, my_handle >> 14, (long)my_txt1);
		}
	}
}


I suggest putting a post in the BUGS forum...
(with your code example...)


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial