Commit 935ec054 authored by Tyler Wilson's avatar Tyler Wilson
Browse files

Modified ExportControlNetWorkOrder::setupExecution() so that it no longer seg...

Modified ExportControlNetWorkOrder::setupExecution() so that it no longer seg faults when the user attempts to export a control network from the file menu.  Fixes #4816

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce_FY17-Sprint1@7625 41f8697f-d340-4b68-9986-7bafba869bb8
parent b533e94d
Loading
Loading
Loading
Loading
+31 −17
Original line number Diff line number Diff line
@@ -121,7 +121,21 @@ namespace Isis {
      Control *control = NULL;
      // See if there are any other control lists in the project and give these to the user as
      // choices for control nets they can export.
      if (controlList()->isEmpty()) {


      if(project()) {

        Project *proj = project();

        QList<ControlList *> controls = proj->controls();
        if (controls.count() > 0) {
          ControlList *l=controls.first();
          WorkOrder::setData(l);
          control = controlList()->first();
        }

        else {

          QMap<Control *, QString> cnetChoices;
          foreach (ControlList *list, project()->controls()) {
            foreach (Control *control, *list) {
@@ -138,12 +152,12 @@ namespace Isis {

          control = cnetChoices.key(choice);
          internalData.append(control->id());


        }
      // Otherwise, export the control net associated with this work order.
      else {
        control = controlList()->first();
      }


      QString destination =
          QFileDialog::getSaveFileName(NULL, QString("Export Control Network"),
          "./" + FileName(control->fileName()).name());
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ namespace Isis {
   *   @history 2017-04-11 Ian Humphrey - Updated to match work order redesign. Replaced asyncRedo
   *                           and postSyncRedo with execute and postExecution. Separated
   *                           setup and action into setupExecution and execute. Fixes #4763.
   *   @history 2017-05-01 Tyler Wilson - Modified the setupExecution() function so that
   *                           it no longer causes a segmentation fault when the user attempts
   *                           to export a control network from the file menu.  Fixes #4816.
   */
  class ExportControlNetWorkOrder : public WorkOrder {
      Q_OBJECT