about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-31 16:40:50 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-31 16:48:51 -0700
commit37a173b8a9c09ba96f6f8b75b89ae4e9521d5273 (patch)
tree6010a1f7e741e4527ce72eedacdfae204b563857
parentf42272c0afbfa6b8295fd30e11994d4479e08f08 (diff)
downloadmu-37a173b8a9c09ba96f6f8b75b89ae4e9521d5273.tar.gz
1908 - another null-pointer warning
-rw-r--r--030container.cc5
-rw-r--r--edit.mu18
2 files changed, 20 insertions, 3 deletions
diff --git a/030container.cc b/030container.cc
index 15a6eb6f..41bba748 100644
--- a/030container.cc
+++ b/030container.cc
@@ -125,6 +125,11 @@ case GET: {
     products.resize(1);
     break;
   }
+  if (base_address == 0) {
+    raise << current_recipe_name() << ": tried to access location 0 in '" << current_instruction().to_string() << "'\n" << end();
+    products.resize(1);
+    break;
+  }
   assert(scalar(ingredients.at(1)));
   long long int offset = ingredients.at(1).at(0);
   long long int src = base_address;
diff --git a/edit.mu b/edit.mu
index b8087a5a..9b8b0c49 100644
--- a/edit.mu
+++ b/edit.mu
@@ -2333,8 +2333,8 @@ container programming-environment-data [
   recipes:address:editor-data
   recipe-warnings:address:array:character
   current-sandbox:address:editor-data
-  sandbox:address:sandbox-data
-  sandbox-in-focus?:boolean  # false => focus in recipes; true => focus in current-sandbox
+  sandbox:address:sandbox-data  # list of sandboxes, from top to bottom
+  sandbox-in-focus?:boolean  # false => cursor in recipes; true => cursor in current-sandbox
 ]
 
 recipe new-programming-environment [
@@ -2610,6 +2610,7 @@ recipe event-loop [
     {
       t:address:touch-event <- maybe-convert e:event, touch:variant
       break-unless t
+#?       $print [touch 0], 10/newline #? 1
       # ignore all but 'left-click' events for now
       # todo: test this
       touch-type:number <- get *t, type:offset
@@ -2618,6 +2619,7 @@ recipe event-loop [
       # later exceptions for non-editor touches will go here
       +global-touch
       # send to both editors
+#?       $print [sending touch to editors], 10/newline #? 1
       _ <- move-cursor-in-editor screen, recipes, *t
       *sandbox-in-focus? <- move-cursor-in-editor screen, current-sandbox, *t
       render-minimal screen, env
@@ -2674,7 +2676,11 @@ container sandbox-data [
   data:address:array:character
   response:address:array:character
   warnings:address:array:character
-  starting-row-on-screen:number  # to track clicks on delete
+#?   foo:number
+#?   expected-response:address:array:character
+  # coordinates to track clicks
+  starting-row-on-screen:number
+  response-starting-row-on-screen:number
   screen:address:screen  # prints in the sandbox go here
   next-sandbox:address:sandbox-data
 ]
@@ -3229,18 +3235,24 @@ recipe foo [
 after +global-touch [
   # right side of screen and below sandbox editor? pop appropriate sandbox
   # contents back into sandbox editor provided it's empty
+#?   $print [touch 1], 10/newline #? 1
   {
     sandbox-left-margin:number <- get *current-sandbox, left:offset
     click-column:number <- get *t, column:offset
     on-sandbox-side?:boolean <- greater-or-equal click-column, sandbox-left-margin
     break-unless on-sandbox-side?
     first-sandbox:address:sandbox-data <- get *env, sandbox:offset
+    break-unless first-sandbox
     first-sandbox-begins:number <- get *first-sandbox, starting-row-on-screen:offset
+#?     $print first-sandbox-begins, 10/newline #? 1
     click-row:number <- get *t, row:offset
+#?     $print [click row ], click-row, 10/newline #? 1
     below-sandbox-editor?:boolean <- greater-or-equal click-row, first-sandbox-begins
     break-unless below-sandbox-editor?
+#?     $print [below sandbox editor], 10/newline #? 1
     empty-sandbox-editor?:boolean <- empty-editor? current-sandbox
     break-unless empty-sandbox-editor?  # make the user hit F4 before editing a new sandbox
+#?     $print [on sandbox], 10/newline #? 1
     # identify the sandbox to edit and remove it from the sandbox list
     sandbox:address:sandbox-data <- extract-sandbox env, click-row
     text:address:array:character <- get *sandbox, data:offset