Skip to content

Commit

Permalink
Handle the case when no frames are captured and JSON printed
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Jan 30, 2019
1 parent af35bab commit 470d4a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions html_renderer/src/App.vue
Expand Up @@ -59,15 +59,15 @@ export default {
},
computed: {
rootFrame() {
if (this.session) {
if (this.session && this.session.root_frame) {
return new FrameModel(this.session.root_frame)
}
}
},
watch: {
session: {
handler() {
if (!this.session) {
if (!this.session || !this.rootFrame) {
document.title = 'Pyinstrument';
return;
}
Expand Down
2 changes: 2 additions & 0 deletions pyinstrument/renderers/jsonrenderer.py
Expand Up @@ -9,6 +9,8 @@

class JSONRenderer(Renderer):
def render_frame(self, frame):
if frame is None:
return u'null'
# we don't use the json module because it uses 2x stack frames, so
# crashes on deep but valid call stacks

Expand Down

0 comments on commit 470d4a2

Please sign in to comment.