iOS - CoreData服务器数据返回是"<null>":

     在做一个项目时,发现,有时候服务器(Java或者C写的,Ubuntu环境),某个参数没有值的时候会返回一个“<null>”, 尤其是在维护项目 的时候,往往一些参数废弃,经常会因为这些 "<null>"导致程序 Carsh.因为数据库在写入"<null>"的时候写不进去.

    所以有时候最好在返回参数的时候做出判断.以增强程序的健壮性.可以直接写入一个空字符。如@“”;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QtWidgets> #include <QResizeEvent> //绘图区域大小变化事件 #include <QDebug> #include <QThread> #include <QTimer> #include <QVector> #include <QRandomGenerator> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); ui->plot->setOpenGl(true); ui->plot->setNoAntialiasingOnDrag(true); CreateChart(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::CreateChart() { ui->plot->addGraph(); ui->plot->graph(0)->setPen(QPen(QColor(100,149,237))); mData = ui->plot->graph(0)->data()->coreData(); ui->plot->xAxis2->setVisible(true); ui->plot->xAxis2->setTickLabels(false); ui->plot->yAxis2->setVisible(true); ui->plot->yAxis2->setTickLabels(false); connect(ui->plot->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->plot->xAxis2, SLOT(setRange(QCPRange))); connect(ui->plot->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->plot->yAxis2, SLOT(setRange(QCPRange))); ui->plot->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom|QCP::iSelectPlottables); ui->plot->yAxis->setRange(-1.5,1.5); ui->plot->xAxis->setRange(0,50); ui->plot->yAxis->setLabel("数据"); ui->plot->xAxis->setLabel("个数"); for (int i = 0; i < 50; i++) { mXDataTol.append(i); mYDataTol.append(QRandomGenerator::global()->bounded(1.00)); } ui->plot->graph(0)->setData(mXDataTol,mYDataTol,true); ui->plot->replot(); }这是我的全部代码,系统报错:terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc请帮我修改一下代码,我不知道到底哪里出了错
最新发布
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值