[quote user="Artem bursuk"]I'm pretty sure none of pointers controlled by me is null[/quote]
Ah, the confident cry of the eternal programmer!
That's what ASSERT will confirm for you.
Also, classes that inherit from RefCounted have an .IsValid() member..
file = DgnFile::Create(...); ASSERT (file.IsValid());