Task: Segfault protection

This commit is contained in:
Paul Beckingham
2015-08-22 07:45:10 -04:00
parent 23318103ed
commit 4e9ec1b320

View File

@@ -25,6 +25,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <cmake.h> #include <cmake.h>
#include <iostream> // TODO Remove
#include <sstream> #include <sstream>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
@@ -1969,6 +1970,8 @@ void Task::modify (modType type, bool text_required /* = false */)
{ {
if (a._lextype == Lexer::Type::pair) if (a._lextype == Lexer::Type::pair)
{ {
// std::cout << "# Task::modify " << a.dump () << "\n";
// 'canonical' is the canonical name. Needs to be said. // 'canonical' is the canonical name. Needs to be said.
// 'value' requires eval. // 'value' requires eval.
std::string name = a.attribute ("canonical"); std::string name = a.attribute ("canonical");
@@ -1987,11 +1990,10 @@ void Task::modify (modType type, bool text_required /* = false */)
{ {
Lexer::dequote (value); Lexer::dequote (value);
// Get the column info. // Get the column info. Some columns are not modifiable.
Column* column = context.columns[name]; Column* column = context.columns[name];
if (! column ||
// Some columns are not modifiable. ! column->modifiable ())
if (! column->modifiable ())
throw format (STRING_INVALID_MOD, name, value); throw format (STRING_INVALID_MOD, name, value);
// Dependencies are specified as IDs. // Dependencies are specified as IDs.