@@ -620,13 +620,20 @@ char* CTraderApi::ReqOrderInsert(
620
620
void CTraderApi::OnRspOrderInsert (CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
621
621
{
622
622
OrderIDType orderId = { 0 };
623
- sprintf (orderId, " %d:%d:%s" , m_RspUserLogin.FrontID , m_RspUserLogin.SessionID , pInputOrder->OrderRef );
623
+ if (pInputOrder)
624
+ {
625
+ sprintf (orderId, " %d:%d:%s" , m_RspUserLogin.FrontID , m_RspUserLogin.SessionID , pInputOrder->OrderRef );
626
+ }
627
+ else
628
+ {
629
+ IsErrorRspInfo (pRspInfo, nRequestID, bIsLast);
630
+ }
624
631
625
632
unordered_map<string, OrderField*>::iterator it = m_id_platform_order.find (orderId);
626
633
if (it == m_id_platform_order.end ())
627
634
{
628
635
// 没找到?不应当,这表示出错了
629
- assert (false );
636
+ // assert(false);
630
637
}
631
638
else
632
639
{
@@ -645,7 +652,14 @@ void CTraderApi::OnRspOrderInsert(CSecurityFtdcInputOrderField *pInputOrder, CSe
645
652
void CTraderApi::OnErrRtnOrderInsert (CSecurityFtdcInputOrderField *pInputOrder, CSecurityFtdcRspInfoField *pRspInfo)
646
653
{
647
654
OrderIDType orderId = { 0 };
648
- sprintf (orderId, " %d:%d:%s" , m_RspUserLogin.FrontID , m_RspUserLogin.SessionID , pInputOrder->OrderRef );
655
+ if (pInputOrder)
656
+ {
657
+ sprintf (orderId, " %d:%d:%s" , m_RspUserLogin.FrontID , m_RspUserLogin.SessionID , pInputOrder->OrderRef );
658
+ }
659
+ else
660
+ {
661
+ IsErrorRspInfo (pRspInfo, 0 , true );
662
+ }
649
663
650
664
unordered_map<string, OrderField*>::iterator it = m_id_platform_order.find (orderId);
651
665
if (it == m_id_platform_order.end ())
@@ -733,13 +747,20 @@ int CTraderApi::ReqOrderAction(CSecurityFtdcOrderField *pOrder)
733
747
void CTraderApi::OnRspOrderAction (CSecurityFtdcInputOrderActionField *pInputOrderAction, CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
734
748
{
735
749
OrderIDType orderId = { 0 };
736
- sprintf (orderId, " %d:%d:%s" , pInputOrderAction->FrontID , pInputOrderAction->SessionID , pInputOrderAction->OrderRef );
750
+ if (pInputOrderAction)
751
+ {
752
+ sprintf (orderId, " %d:%d:%s" , pInputOrderAction->FrontID , pInputOrderAction->SessionID , pInputOrderAction->OrderRef );
753
+ }
754
+ else
755
+ {
756
+ IsErrorRspInfo (pRspInfo, nRequestID, bIsLast);
757
+ }
737
758
738
759
unordered_map<string, OrderField*>::iterator it = m_id_platform_order.find (orderId);
739
760
if (it == m_id_platform_order.end ())
740
761
{
741
762
// 没找到?不应当,这表示出错了
742
- assert (false );
763
+ // assert(false);
743
764
}
744
765
else
745
766
{
@@ -756,13 +777,20 @@ void CTraderApi::OnRspOrderAction(CSecurityFtdcInputOrderActionField *pInputOrde
756
777
void CTraderApi::OnErrRtnOrderAction (CSecurityFtdcOrderActionField *pOrderAction, CSecurityFtdcRspInfoField *pRspInfo)
757
778
{
758
779
OrderIDType orderId = { 0 };
759
- sprintf (orderId, " %d:%d:%s" , pOrderAction->FrontID , pOrderAction->SessionID , pOrderAction->OrderRef );
780
+ if (pOrderAction)
781
+ {
782
+ sprintf (orderId, " %d:%d:%s" , pOrderAction->FrontID , pOrderAction->SessionID , pOrderAction->OrderRef );
783
+ }
784
+ else
785
+ {
786
+ IsErrorRspInfo (pRspInfo, 0 , true );
787
+ }
760
788
761
789
unordered_map<string, OrderField*>::iterator it = m_id_platform_order.find (orderId);
762
790
if (it == m_id_platform_order.end ())
763
791
{
764
792
// 没找到?不应当,这表示出错了
765
- assert (false );
793
+ // assert(false);
766
794
}
767
795
else
768
796
{
0 commit comments