Rule 1. Never fly without rebuy.
Rule 2. Never fly without rebuy.
Rule 3. Can you guess what it is?
I'd head back to a safe system asap and do a few courier missions quick to get enough credits for a rebuy...then go out exploring.
If you're a semi competent pilot then it shouldn't be an issue as NPCs shouldn't pose much of a threat.