Skip to content
Snippets Groups Projects
Commit 802eb603 authored by Stephen R. van den Berg's avatar Stephen R. van den Berg
Browse files

Thread: Protect against exceptions in backtraces.

parent 9e866942
No related branches found
No related tags found
No related merge requests found
...@@ -239,6 +239,8 @@ optional class Fifo { ...@@ -239,6 +239,8 @@ optional class Fifo {
protected string _sprintf( int f ) protected string _sprintf( int f )
{ {
if (!this) // Only if not destructed
return UNDEFINED;
return f=='O' && sprintf( "%O(%d / %d)", this_program, return f=='O' && sprintf( "%O(%d / %d)", this_program,
size(), read_tres ); size(), read_tres );
} }
...@@ -407,6 +409,8 @@ optional class Queue { ...@@ -407,6 +409,8 @@ optional class Queue {
protected string _sprintf( int f ) protected string _sprintf( int f )
{ {
if (!this) // Only if not destructed
return UNDEFINED;
return f=='O' && sprintf( "%O(%d)", this_program, size() ); return f=='O' && sprintf( "%O(%d)", this_program, size() );
} }
} }
...@@ -506,6 +510,8 @@ optional class Farm ...@@ -506,6 +510,8 @@ optional class Farm
protected string _sprintf( int f ) protected string _sprintf( int f )
{ {
if (!this) // Only if not destructed
return UNDEFINED;
switch( f ) switch( f )
{ {
case 't': case 't':
...@@ -620,6 +626,8 @@ optional class Farm ...@@ -620,6 +626,8 @@ optional class Farm
protected string _sprintf( int f ) protected string _sprintf( int f )
{ {
if (!this) // Only if not destructed
return UNDEFINED;
switch( f ) switch( f )
{ {
case 't': case 't':
...@@ -864,6 +872,8 @@ optional class Farm ...@@ -864,6 +872,8 @@ optional class Farm
protected string _sprintf( int f ) protected string _sprintf( int f )
{ {
if (!this) // Only if not destructed
return UNDEFINED;
return f=='O' && sprintf( "%O(/* %s */)", this_program, debug_status() ); return f=='O' && sprintf( "%O(/* %s */)", this_program, debug_status() );
} }
...@@ -939,6 +949,8 @@ optional class ResourceCount { ...@@ -939,6 +949,8 @@ optional class ResourceCount {
/*semi*/private string _sprintf(int type) { /*semi*/private string _sprintf(int type) {
string res = UNDEFINED; string res = UNDEFINED;
if (!this) // Only if not destructed
return UNDEFINED;
switch(type) { switch(type) {
case 'O': case 'O':
res = sprintf("Count: %d", _count); res = sprintf("Count: %d", _count);
...@@ -1139,6 +1151,8 @@ optional class Fifo ...@@ -1139,6 +1151,8 @@ optional class Fifo
protected string _sprintf( int f ) protected string _sprintf( int f )
{ {
if (!this) // Only if not destructed
return UNDEFINED;
return f=='O' && sprintf( "%O(%d / %d)", this_program, return f=='O' && sprintf( "%O(%d / %d)", this_program,
size(), read_tres ); size(), read_tres );
} }
...@@ -1217,6 +1231,8 @@ optional class Queue ...@@ -1217,6 +1231,8 @@ optional class Queue
protected string _sprintf( int f ) protected string _sprintf( int f )
{ {
if (!this) // Only if not destructed
return UNDEFINED;
return f=='O' && sprintf( "%O(%d)", this_program, size() ); return f=='O' && sprintf( "%O(%d)", this_program, size() );
} }
} }
...@@ -1263,6 +1279,8 @@ class ResourceCount { ...@@ -1263,6 +1279,8 @@ class ResourceCount {
protected string _sprintf(int type) protected string _sprintf(int type)
{ {
string res = UNDEFINED; string res = UNDEFINED;
if (!this) // Only if not destructed
return UNDEFINED;
switch(type) { switch(type) {
case 'O': case 'O':
res = sprintf("Count: %d", _count); res = sprintf("Count: %d", _count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment