check for active_thread != NULL in syscalls.c before using it
check for active_thread != NULL in syscalls.c before using it

fixes #498

kYc0o/RIOT,kushalsingh007/RIOT,centurysys/RIOT,Osblouf/RIOT,OTAkeys/RIOT,kbumsik/RIOT,marcosalm/RIOT,rfswarm/RIOT,automote/RIOT,khhhh/RIOT,chris-wood/RIOT,authmillenon/RIOT,EmuxEvans/RIOT,OTAkeys/RIOT,msolters/RIOT,spium/IoT-RIOT,AnonMall/RIOT,locicontrols/RIOT,herrfz/RIOT,foss-for-synopsys-dwc-arc-processors/RIOT,emmanuelsearch/RIOT,mfrey/RIOT,kerneltask/RIOT,ntrtrung/RIOT,gbarnett/RIOT,binarylemon/RIOT,MohmadAyman/RIOT,1blankz7/RIOT,MohmadAyman/RIOT,A-Paul/RIOT,BytesGalore/PetersRIOT,avmelnikoff/RIOT,changbiao/RIOT,mtausig/RIOT,lazytech-org/RIOT,binarylemon/RIOT,dailab/RIOT,toonst/RIOT,malosek/RIOT,spium/IoT-RIOT,malosek/RIOT,rfuentess/RIOT,locicontrols/RIOT,jhollister/RIOT,zhuoshuguo/RIOT,jremmert-phytec-iot/RIOT,biboc/RIOT,Yonezawa-T2/RIOT,openkosmosorg/RIOT,x3ro/RIOT,Ell-i/RIOT,BytesGalore/RIOT,rousselk/RIOT,Lexandro92/RIOT-CoAP,phiros/RIOT,smlng/RIOT,BytesGalore/RIOT,smlng/RIOT,centurysys/RIOT,rajma996/RIOT,robixnai/RIOT,zhuoshuguo/RIOT,tdautc19841202/RIOT,Josar/RIOT,MonsterCode8000/RIOT,alignan/RIOT,RubikonAlpha/RIOT,RIOT-OS/RIOT,katezilla/RIOT,avmelnikoff/RIOT,OlegHahm/RIOT,robixnai/RIOT,mziegert/RIOT,A-Paul/RIOT,Yonezawa-T2/RIOT,wentaoshang/RIOT,rakendrathapa/RIOT,automote/RIOT,ThanhVic/RIOT,DipSwitch/RIOT,Darredevil/RIOT,RBartz/RIOT,thomaseichinger/RIOT,jasonatran/RIOT,gautric/RIOT,RBartz/RIOT,foss-for-synopsys-dwc-arc-processors/RIOT,tfar/RIOT,rfuentess/RIOT,abkam07/RIOT,spium/IoT-RIOT,marcosalm/RIOT,Darredevil/RIOT,haoyangyu/RIOT,attdona/RIOT,jferreir/RIOT,RIOT-OS/RIOT,authmillenon/RIOT,DipSwitch/RIOT,attdona/RIOT,basilfx/RIOT,brettswann/RIOT,haoyangyu/RIOT,emmanuelsearch/RIOT,EmuxEvans/RIOT,RubikonAlpha/RIOT,Ell-i/RIOT,stevenj/RIOT,ximus/RIOT,khhhh/RIOT,asanka-code/RIOT,benoit-canet/RIOT,kYc0o/RIOT,RBartz/RIOT,nsol-nmsu/RIOT,malosek/RIOT,yogo1212/RIOT,neumodisch/RIOT,daniel-k/RIOT,Lexandro92/RIOT-CoAP,backenklee/RIOT,binarylemon/RIOT,jfischer-phytec-iot/RIOT,BytesGalore/PetersRIOT,mziegert/RIOT,l3nko/RIOT,rfswarm2/RIOT,LudwigOrtmann/RIOT,dhruvvyas90/RIOT,yogo1212/RIOT,jfischer-phytec-iot/RIOT,ntrtrung/RIOT,centurysys/RIOT,abkam07/RIOT,Josar/RIOT,l3nko/RIOT,lebrush/RIOT,neiljay/RIOT,kaspar030/RIOT,openkosmosorg/RIOT,foss-for-synopsys-dwc-arc-processors/RIOT,khhhh/RIOT,arvindpdmn/RIOT,tdautc19841202/RIOT,rfswarm/RIOT,herrfz/RIOT-old,BytesGalore/PetersRIOT,OlegHahm/RIOT,abp719/RIOT,openkosmosorg/RIOT,kaleb-himes/RIOT,herrfz/RIOT,jasonatran/RIOT,ros2/ros2_embedded_riot,MarkXYang/RIOT,kerneltask/RIOT,fnack/RIOT,neumodisch/RIOT,wentaoshang/RIOT,ros2/ros2_embedded_riot,locicontrols/RIOT,ntrtrung/RIOT,marcosalm/RIOT,gebart/RIOT,kb2ma/RIOT,aeneby/RIOT,kerneltask/RIOT,ThanhVic/RIOT,mziegert/RIOT,kushalsingh007/RIOT,Lotterleben/RIOT,d00616/RIOT,rfswarm2/RIOT,thomaseichinger/RIOT,avmelnikoff/RIOT,neiljay/RIOT,LudwigOrtmann/RIOT,TobiasFredersdorf/RIOT,adrianghc/RIOT,biboc/RIOT,cladmi/RIOT,1blankz7/RIOT,ThanhVic/RIOT,RBartz/RIOT,malosek/RIOT,Josar/RIOT,A-Paul/RIOT,MohmadAyman/RIOT,cladmi/RIOT,rfuentess/RIOT,koenning/RIOT,syin2/RIOT,mziegert/RIOT,lebrush/RIOT,herrfz/RIOT-old,katezilla/RIOT,shady33/RIOT,l3nko/RIOT,bartfaizoltan/RIOT,miri64/RIOT,ant9000/RIOT,sumanpanchal/RIOT,neiljay/RIOT,LudwigOrtmann/RIOT,rfuentess/RIOT,adjih/RIOT,alignan/RIOT,MonsterCode8000/RIOT,jremmert-phytec-iot/RIOT,rajma996/RIOT,zhuoshuguo/RIOT,binarylemon/RIOT,bartfaizoltan/RIOT,gbarnett/RIOT,spium/IoT-RIOT,ximus/RIOT,zhuoshuguo/RIOT,LudwigOrtmann/RIOT,arvindpdmn/RIOT,gbarnett/RIOT,authmillenon/RIOT,AnonMall/RIOT,katezilla/RIOT,biboc/RIOT,aeneby/RIOT,kb2ma/RIOT,immesys/RiSyn,Yonezawa-T2/RIOT,roberthartung/RIOT,patkan/RIOT,RubikonAlpha/RIOT,herrfz/RIOT-old,lebrush/RIOT,foss-for-synopsys-dwc-arc-processors/RIOT,MarkXYang/RIOT,automote/RIOT,gbarnett/RIOT,dailab/RIOT,latsku/RIOT,Hyungsin/RIOT-OS,daniel-k/RIOT,sgso/RIOT,mfrey/RIOT,Lotterleben/RIOT,dkm/RIOT,Lotterleben/RIOT,LudwigKnuepfer/RIOT,gebart/RIOT,thiagohd/RIOT,dkm/RIOT,herrfz/RIOT-old,abp719/RIOT,altairpearl/RIOT,ntrtrung/RIOT,cladmi/RIOT,x3ro/RIOT,dhruvvyas90/RIOT,attdona/RIOT,basilfx/RIOT,adjih/RIOT,ntrtrung/RIOT,emmanuelsearch/RIOT,A-Paul/RIOT,dkm/RIOT,asanka-code/RIOT,mfrey/RIOT,miri64/RIOT,jferreir/RIOT,changbiao/RIOT,MonsterCode8000/RIOT,alignan/RIOT,tdautc19841202/RIOT,FrancescoErmini/RIOT,gbarnett/RIOT,avmelnikoff/RIOT,basilfx/RIOT,Darredevil/RIOT,watr-li/RIOT,adjih/RIOT,RIOT-OS/RIOT,rakendrathapa/RIOT,ThanhVic/RIOT,sumanpanchal/RIOT,MarkXYang/RIOT,ks156/RIOT,benoit-canet/RIOT,centurysys/RIOT,backenklee/RIOT,ant9000/RIOT,jasonatran/RIOT,shady33/RIOT,abkam07/RIOT,sumanpanchal/RIOT,lazytech-org/RIOT,luciotorre/RIOT,thomaseichinger/RIOT,gautric/RIOT,luciotorre/RIOT,Osblouf/RIOT,alex1818/RIOT,toonst/RIOT,patkan/RIOT,smlng/RIOT,mfrey/RIOT,zhuoshuguo/RIOT,arvindpdmn/RIOT,rfswarm2/RIOT,mziegert/RIOT,rajma996/RIOT,marcosalm/RIOT,jbeyerstedt/RIOT-OTA-update,jasonatran/RIOT,mfrey/RIOT,hamilton-mote/RIOT-OS,dkm/RIOT,beurdouche/RIOT,locicontrols/RIOT,Lexandro92/RIOT-CoAP,kb2ma/RIOT,neumodisch/RIOT,locicontrols/RIOT,zhuoshuguo/RIOT,Osblouf/RIOT,Darredevil/RIOT,khhhh/RIOT,TobiasFredersdorf/RIOT,JensErdmann/RIOT,RBartz/RIOT,rousselk/RIOT,abkam07/RIOT,luciotorre/RIOT,arvindpdmn/RIOT,plushvoxel/RIOT,neumodisch/RIOT,benoit-canet/RIOT,malosek/RIOT,rousselk/RIOT,roberthartung/RIOT,DipSwitch/RIOT,altairpearl/RIOT,backenklee/RIOT,plushvoxel/RIOT,immesys/RiSyn,x3ro/RIOT,thiagohd/RIOT,automote/RIOT,msolters/RIOT,smlng/RIOT,RubikonAlpha/RIOT,ros2/ros2_embedded_riot,stevenj/RIOT,AnonMall/RIOT,latsku/RIOT,binarylemon/RIOT,PSHIVANI/Riot-Code,plushvoxel/RIOT,authmillenon/RIOT,Hyungsin/RIOT-OS,jasonatran/RIOT,asanka-code/RIOT,kaspar030/RIOT,kaleb-himes/RIOT,stevenj/RIOT,phiros/RIOT,automote/RIOT,neumodisch/RIOT,stevenj/RIOT,BytesGalore/RIOT,kushalsingh007/RIOT,Lexandro92/RIOT-CoAP,aeneby/RIOT,brettswann/RIOT,basilfx/RIOT,kbumsik/RIOT,lazytech-org/RIOT,immesys/RiSyn,phiros/RIOT,patkan/RIOT,d00616/RIOT,Ell-i/RIOT,attdona/RIOT,gbarnett/RIOT,gautric/RIOT,rakendrathapa/RIOT,kaspar030/RIOT,roberthartung/RIOT,phiros/RIOT,bartfaizoltan/RIOT,dailab/RIOT,jfischer-phytec-iot/RIOT,authmillenon/RIOT,jremmert-phytec-iot/RIOT,rajma996/RIOT,lebrush/RIOT,lebrush/RIOT,immesys/RiSyn,BytesGalore/PetersRIOT,1blankz7/RIOT,robixnai/RIOT,mtausig/RIOT,daniel-k/RIOT,josephnoir/RIOT,nsol-nmsu/RIOT,RubikonAlpha/RIOT,sgso/RIOT,luciotorre/RIOT,centurysys/RIOT,nsol-nmsu/RIOT,mtausig/RIOT,watr-li/RIOT,LudwigKnuepfer/RIOT,asanka-code/RIOT,rfswarm/RIOT,syin2/RIOT,tdautc19841202/RIOT,khhhh/RIOT,rfswarm2/RIOT,ant9000/RIOT,sgso/RIOT,JensErdmann/RIOT,abp719/RIOT,BytesGalore/PetersRIOT,Yonezawa-T2/RIOT,gautric/RIOT,kushalsingh007/RIOT,Lotterleben/RIOT,latsku/RIOT,alex1818/RIOT,benoit-canet/RIOT,kb2ma/RIOT,jferreir/RIOT,rakendrathapa/RIOT,1blankz7/RIOT,rfswarm2/RIOT,adjih/RIOT,dhruvvyas90/RIOT,ks156/RIOT,thomaseichinger/RIOT,brettswann/RIOT,rfswarm/RIOT,jbeyerstedt/RIOT-OTA-update,shady33/RIOT,gebart/RIOT,alex1818/RIOT,hamilton-mote/RIOT-OS,rajma996/RIOT,jbeyerstedt/RIOT-OTA-update,brettswann/RIOT,sumanpanchal/RIOT,alex1818/RIOT,daniel-k/RIOT,msolters/RIOT,lazytech-org/RIOT,ntrtrung/RIOT,1blankz7/RIOT,rfswarm2/RIOT,adjih/RIOT,BytesGalore/PetersRIOT,LudwigOrtmann/RIOT,immesys/RiSyn,jremmert-phytec-iot/RIOT,EmuxEvans/RIOT,robixnai/RIOT,dailab/RIOT,kYc0o/RIOT,syin2/RIOT,rajma996/RIOT,BytesGalore/PetersRIOT,AnonMall/RIOT,altairpearl/RIOT,automote/RIOT,emmanuelsearch/RIOT,tfar/RIOT,d00616/RIOT,robixnai/RIOT,PSHIVANI/Riot-Code,watr-li/RIOT,fnack/RIOT,EmuxEvans/RIOT,Josar/RIOT,abp719/RIOT,kbumsik/RIOT,Hyungsin/RIOT-OS,x3ro/RIOT,watr-li/RIOT,latsku/RIOT,TobiasFredersdorf/RIOT,changbiao/RIOT,katezilla/RIOT,OlegHahm/RIOT,watr-li/RIOT,attdona/RIOT,RIOT-OS/RIOT,yogo1212/RIOT,alex1818/RIOT,jremmert-phytec-iot/RIOT,l3nko/RIOT,rfuentess/RIOT,toonst/RIOT,kYc0o/RIOT,ximus/RIOT,backenklee/RIOT,yogo1212/RIOT,OTAkeys/RIOT,gebart/RIOT,koenning/RIOT,nsol-nmsu/RIOT,Lexandro92/RIOT-CoAP,arvindpdmn/RIOT,phiros/RIOT,thiagohd/RIOT,bartfaizoltan/RIOT,alignan/RIOT,kushalsingh007/RIOT,avmelnikoff/RIOT,patkan/RIOT,DipSwitch/RIOT,backenklee/RIOT,asanka-code/RIOT,herrfz/RIOT,stevenj/RIOT,syin2/RIOT,kaspar030/RIOT,koenning/RIOT,mtausig/RIOT,msolters/RIOT,MonsterCode8000/RIOT,tdautc19841202/RIOT,JensErdmann/RIOT,josephnoir/RIOT,malosek/RIOT,FrancescoErmini/RIOT,miri64/RIOT,openkosmosorg/RIOT,ros2/ros2_embedded_riot,latsku/RIOT,ros2/ros2_embedded_riot,kerneltask/RIOT,altairpearl/RIOT,jbeyerstedt/RIOT-OTA-update,daniel-k/RIOT,MonsterCode8000/RIOT,OTAkeys/RIOT,gautric/RIOT,d00616/RIOT,Lexandro92/RIOT-CoAP,l3nko/RIOT,alignan/RIOT,adrianghc/RIOT,haoyangyu/RIOT,sumanpanchal/RIOT,beurdouche/RIOT,plushvoxel/RIOT,jferreir/RIOT,Osblouf/RIOT,jfischer-phytec-iot/RIOT,bartfaizoltan/RIOT,AnonMall/RIOT,jhollister/RIOT,Lotterleben/RIOT,spium/IoT-RIOT,shady33/RIOT,Josar/RIOT,benoit-canet/RIOT,mziegert/RIOT,miri64/RIOT,plushvoxel/RIOT,altairpearl/RIOT,PSHIVANI/Riot-Code,abp719/RIOT,kYc0o/RIOT,locicontrols/RIOT,wentaoshang/RIOT,abp719/RIOT,OTAkeys/RIOT,Yonezawa-T2/RIOT,haoyangyu/RIOT,toonst/RIOT,ThanhVic/RIOT,toonst/RIOT,koenning/RIOT,dkm/RIOT,rousselk/RIOT,herrfz/RIOT-old,MarkXYang/RIOT,ant9000/RIOT,adrianghc/RIOT,thiagohd/RIOT,lebrush/RIOT,thiagohd/RIOT,katezilla/RIOT,tfar/RIOT,ks156/RIOT,sgso/RIOT,patkan/RIOT,koenning/RIOT,JensErdmann/RIOT,Yonezawa-T2/RIOT,stevenj/RIOT,centurysys/RIOT,tfar/RIOT,dhruvvyas90/RIOT,brettswann/RIOT,thiagohd/RIOT,MarkXYang/RIOT,ks156/RIOT,ros2/ros2_embedded_riot,kaleb-himes/RIOT,marcosalm/RIOT,jferreir/RIOT,locicontrols/RIOT,chris-wood/RIOT,binarylemon/RIOT,ximus/RIOT,beurdouche/RIOT,hamilton-mote/RIOT-OS,kaspar030/RIOT,patkan/RIOT,kushalsingh007/RIOT,Ell-i/RIOT,emmanuelsearch/RIOT,OlegHahm/RIOT,PSHIVANI/Riot-Code,TobiasFredersdorf/RIOT,altairpearl/RIOT,LudwigKnuepfer/RIOT,haoyangyu/RIOT,koenning/RIOT,jhollister/RIOT,aeneby/RIOT,l3nko/RIOT,herrfz/RIOT,Osblouf/RIOT,neiljay/RIOT,FrancescoErmini/RIOT,ThanhVic/RIOT,marcosalm/RIOT,dailab/RIOT,phiros/RIOT,neumodisch/RIOT,authmillenon/RIOT,biboc/RIOT,jferreir/RIOT,watr-li/RIOT,chris-wood/RIOT,MohmadAyman/RIOT,wentaoshang/RIOT,RubikonAlpha/RIOT,brettswann/RIOT,tdautc19841202/RIOT,cladmi/RIOT,khhhh/RIOT,luciotorre/RIOT,TobiasFredersdorf/RIOT,alex1818/RIOT,kbumsik/RIOT,changbiao/RIOT,chris-wood/RIOT,d00616/RIOT,roberthartung/RIOT,kerneltask/RIOT,yogo1212/RIOT,LudwigKnuepfer/RIOT,beurdouche/RIOT,roberthartung/RIOT,Lotterleben/RIOT,jhollister/RIOT,A-Paul/RIOT,msolters/RIOT,attdona/RIOT,jhollister/RIOT,abkam07/RIOT,EmuxEvans/RIOT,arvindpdmn/RIOT,asanka-code/RIOT,FrancescoErmini/RIOT,RIOT-OS/RIOT,tfar/RIOT,yogo1212/RIOT,ximus/RIOT,changbiao/RIOT,foss-for-synopsys-dwc-arc-processors/RIOT,d00616/RIOT,rousselk/RIOT,syin2/RIOT,DipSwitch/RIOT,hamilton-mote/RIOT-OS,JensErdmann/RIOT,rfswarm/RIOT,neiljay/RIOT,1blankz7/RIOT,openkosmosorg/RIOT,spium/IoT-RIOT,rfswarm/RIOT,BytesGalore/RIOT,jfischer-phytec-iot/RIOT,mtausig/RIOT,adrianghc/RIOT,fnack/RIOT,biboc/RIOT,RBartz/RIOT,x3ro/RIOT,sgso/RIOT,immesys/RiSyn,fnack/RIOT,herrfz/RIOT,openkosmosorg/RIOT,ant9000/RIOT,sumanpanchal/RIOT,jremmert-phytec-iot/RIOT,Lotterleben/RIOT,kaleb-himes/RIOT,latsku/RIOT,rakendrathapa/RIOT,chris-wood/RIOT,basilfx/RIOT,FrancescoErmini/RIOT,benoit-canet/RIOT,aeneby/RIOT,herrfz/RIOT,shady33/RIOT,Darredevil/RIOT,ros2/ros2_embedded_riot,dhruvvyas90/RIOT,josephnoir/RIOT,msolters/RIOT,wentaoshang/RIOT,PSHIVANI/Riot-Code,MarkXYang/RIOT,sgso/RIOT,EmuxEvans/RIOT,robixnai/RIOT,smlng/RIOT,wentaoshang/RIOT,abkam07/RIOT,jhollister/RIOT,miri64/RIOT,fnack/RIOT,Hyungsin/RIOT-OS,nsol-nmsu/RIOT,LudwigKnuepfer/RIOT,lazytech-org/RIOT,OlegHahm/RIOT,AnonMall/RIOT,rousselk/RIOT,jbeyerstedt/RIOT-OTA-update,MohmadAyman/RIOT,luciotorre/RIOT,adrianghc/RIOT,LudwigOrtmann/RIOT,BytesGalore/RIOT,rakendrathapa/RIOT,Hyungsin/RIOT-OS,emmanuelsearch/RIOT,Darredevil/RIOT,beurdouche/RIOT,gebart/RIOT,josephnoir/RIOT,daniel-k/RIOT,ks156/RIOT,cladmi/RIOT,Osblouf/RIOT,thomaseichinger/RIOT,haoyangyu/RIOT,Ell-i/RIOT,DipSwitch/RIOT,JensErdmann/RIOT,kaleb-himes/RIOT,MonsterCode8000/RIOT,hamilton-mote/RIOT-OS,fnack/RIOT,shady33/RIOT,FrancescoErmini/RIOT,kbumsik/RIOT,changbiao/RIOT,dhruvvyas90/RIOT,josephnoir/RIOT,ximus/RIOT,kb2ma/RIOT,bartfaizoltan/RIOT,MohmadAyman/RIOT,chris-wood/RIOT,PSHIVANI/Riot-Code